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)
===================
* 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)
===================
# cython.* namespace for pure mode.
from __future__ import absolute_import
-__version__ = "0.28.4"
+__version__ = "0.28.5"
try:
from __builtin__ import basestring
#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
} 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);
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
================================
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):
"""
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"