Imported Upstream version 0.28.5 upstream/0.28.5
authorDongHun Kwak <dh0128.kwak@samsung.com>
Thu, 31 Dec 2020 03:04:09 +0000 (12:04 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Thu, 31 Dec 2020 03:04:09 +0000 (12:04 +0900)
CHANGES.rst
Cython/Shadow.py
Cython/Utility/ModuleSetupCode.c
Cython/Utility/StringTools.c
docs/src/userguide/external_C_code.rst
tests/run/fused_types.pyx

index 59545c644d4a8e1ca9599224e1424ad860e29dc2..6af53424b97dece8a616cd0af2d428225d046063 100644 (file)
@@ -2,6 +2,19 @@
 Cython Changelog
 ================
 
+0.28.5 (2018-08-03)
+===================
+
+Bugs fixed
+----------
+
+* The discouraged usage of GCC's attribute ``optimize("Os")`` was replaced by the
+  similar attribute ``cold`` to reduce the code impact of the module init functions.
+  (Github issue #2494)
+
+* A reference leak in Py2.x was fixed when comparing str to unicode for equality.
+
+
 0.28.4 (2018-07-08)
 ===================
 
@@ -32,6 +45,9 @@ Bugs fixed
 * Work around a crash bug in g++ 4.4.x by disabling the size reduction setting
   of the module init function in this version.  (Github issue #2235)
 
+* Crash when exceptions occur early during module initialisation.
+  (Github issue #2199)
+
 
 0.28.2 (2018-04-13)
 ===================
index f126c4423125d08ba547f140943d9fcc384d98f0..30d4aac84f72cb3e05e902d1830076469ba643f3 100644 (file)
@@ -1,7 +1,7 @@
 # cython.* namespace for pure mode.
 from __future__ import absolute_import
 
-__version__ = "0.28.4"
+__version__ = "0.28.5"
 
 try:
     from __builtin__ import basestring
index 7b9d245c7e5db2ba925af1ce410c590141deefbc..2ced47e4cdb115a1b976d2817829a360fa08518a 100644 (file)
@@ -671,7 +671,7 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
     #define CYTHON_SMALL_CODE
 #elif defined(__GNUC__) && (!(defined(__cplusplus)) || (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 4)))
     // At least g++ 4.4.7 can generate crashing code with this option. (GH #2235)
-    #define CYTHON_SMALL_CODE __attribute__((optimize("Os")))
+    #define CYTHON_SMALL_CODE __attribute__((cold))
 #else
     #define CYTHON_SMALL_CODE
 #endif
index 3950e723f7911cab398202ffb1f5a96324618e37..2489e6630e9806831f8c729fef5cd7df3ca1103b 100644 (file)
@@ -235,6 +235,9 @@ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int
     } else {
         int result;
         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
+        #if PY_MAJOR_VERSION < 3
+        Py_XDECREF(owned_ref);
+        #endif
         if (!py_result)
             return -1;
         result = __Pyx_PyObject_IsTrue(py_result);
index cc8b6c90ae2860e1a36a59321b45506314b6fe62..896aae7fec1a083cea8e775a2e307fc5f11c1ed6 100644 (file)
@@ -363,6 +363,10 @@ It is also possible to combine a header file and verbatim C code::
 In this case, the C code ``#undef int`` is put right after
 ``#include "badheader.h"`` in the C code generated by Cython.
 
+Note that the string is parsed like any other docstring in Python.
+If you require character escapes to be passed into the C code file,
+use a raw docstring, i.e. ``r""" ... """``.
+
 
 Using Cython Declarations from C
 ================================
index 2c05c516df4107e8e33f345d7dcbb15ef9aed145..f7493a79f82d90cf98bea521750c0889f506ea7a 100644 (file)
@@ -119,12 +119,12 @@ def test_fused_with_pointer():
     print
     print fused_with_pointer(string_array).decode('ascii')
 
-cdef fused_type1* fused_pointer_except_null(fused_type1 x) except NULL:
+cdef fused_type1* fused_pointer_except_null(fused_type1* x) except NULL:
     if fused_type1 is string_t:
-        assert(bool(x))
+        assert(bool(x[0]))
     else:
-        assert(x < 10)
-    return &x
+        assert(x[0] < 10)
+    return x
 
 def test_fused_pointer_except_null(value):
     """
@@ -145,11 +145,14 @@ def test_fused_pointer_except_null(value):
     AssertionError
     """
     if isinstance(value, int):
-        print fused_pointer_except_null(<cython.int>value)[0]
+        test_int = cython.declare(cython.int, value)
+        print fused_pointer_except_null(&test_int)[0]
     elif isinstance(value, float):
-        print fused_pointer_except_null(<cython.float>value)[0]
+        test_float = cython.declare(cython.float, value)
+        print fused_pointer_except_null(&test_float)[0]
     elif isinstance(value, bytes):
-        print fused_pointer_except_null(<string_t>value)[0].decode('ascii')
+        test_str = cython.declare(string_t, value)
+        print fused_pointer_except_null(&test_str)[0].decode('ascii')
 
 include "cythonarrayutil.pxi"