Cython Changelog
================
+0.29.3 (2019-01-19)
+===================
+
+Bugs fixed
+----------
+
+* Some C code for memoryviews was generated in a non-deterministic order.
+ Patch by Martijn van Steenbergen. (Github issue #2779)
+
+* C89 compatibility was accidentally lost since 0.28.
+ Patches by gastineau and true-pasky. (Github issues #2778, #2801)
+
+* A C compiler cast warning was resolved.
+ Patch by Michael Buesch. (Github issue #2774)
+
+* An compilation failure with complex numbers under MSVC++ was resolved.
+ (Github issue #2797)
+
+* Coverage reporting could fail when modules were moved around after the build.
+ Patch by Wenjun Si. (Github issue #2776)
+
+
0.29.2 (2018-12-14)
===================
try-except and try-finally blocks to clean up temps in the
error case.
"""
- return [(cname, type)
- for (type, manage_ref), freelist in self.temps_free.items() if manage_ref
- for cname in freelist[0]]
+ return sorted([ # Enforce deterministic order.
+ (cname, type)
+ for (type, manage_ref), freelist in self.temps_free.items() if manage_ref
+ for cname in freelist[0]
+ ])
def start_collecting_temps(self):
"""
if c_file is None:
c_file, py_file = self._find_source_files(filename)
if not c_file:
- return None
+ return None # unknown file
# parse all source file paths and lines from C file
# to learn about all relevant source files right away (pyx/pxi/pxd)
# is not from the main .pyx file but a file with a different
# name than the .c file (which prevents us from finding the
# .c file)
- self._parse_lines(c_file, filename)
+ _, code = self._parse_lines(c_file, filename)
+ if code is None:
+ return None # no source found
if self._file_path_map is None:
self._file_path_map = {}
# cython.* namespace for pure mode.
from __future__ import absolute_import
-__version__ = "0.29.2"
+__version__ = "0.29.3"
try:
from __builtin__ import basestring
theta = 0;
} else {
r = -a.real;
- theta = atan2{{m}}(0, -1);
+ theta = atan2{{m}}(0.0, -1.0);
}
} else {
r = __Pyx_c_abs{{func_suffix}}(a);
typedef int Py_tss_t;
static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
*key = PyThread_create_key();
- return 0; // PyThread_create_key reports success always
+ return 0; /* PyThread_create_key reports success always */
}
static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
}
// PyThread_delete_key_value(key) is equalivalent to PyThread_set_key_value(key, NULL)
// PyThread_ReInitTLS() is a no-op
-#endif // TSS (Thread Specific Storage) API
+#endif /* TSS (Thread Specific Storage) API */
#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
#else
// non-CPython
{
- uval = NULL;
PyObject *sign = NULL, *padding = NULL;
+ uval = NULL;
if (uoffset > 0) {
prepend_sign = !!prepend_sign;
if (uoffset > prepend_sign) {
digit_pos = abs((int)(remaining % (8*8)));
remaining = ({{TYPE}}) (remaining / (8*8));
dpos -= 2;
- *(uint16_t*)dpos = ((uint16_t*)DIGIT_PAIRS_8)[digit_pos]; /* copy 2 digits at a time */
+ *(uint16_t*)dpos = ((const uint16_t*)DIGIT_PAIRS_8)[digit_pos]; /* copy 2 digits at a time */
last_one_off = (digit_pos < 8);
break;
case 'd':
digit_pos = abs((int)(remaining % (10*10)));
remaining = ({{TYPE}}) (remaining / (10*10));
dpos -= 2;
- *(uint16_t*)dpos = ((uint16_t*)DIGIT_PAIRS_10)[digit_pos]; /* copy 2 digits at a time */
+ *(uint16_t*)dpos = ((const uint16_t*)DIGIT_PAIRS_10)[digit_pos]; /* copy 2 digits at a time */
last_one_off = (digit_pos < 10);
break;
case 'x':
.. literalinclude:: ../../examples/userguide/numpy_tutorial/compute_py.py
-This should be compiled to produce :file:`convolve_cy.so` (for Linux systems,
-on Windows systems, this will be a ``.pyd`` file). We
+This should be compiled to produce :file:`compute_cy.so` for Linux systems
+(on Windows systems, this will be a ``.pyd`` file). We
run a Python session to test both the Python version (imported from
``.py``-file) and the compiled Cython module.
--- /dev/null
+# mode: run
+# tag: coverage,trace
+
+"""
+PYTHON setup.py build_ext -i
+PYTHON -c "import shutil; shutil.move('ext_src/ext_pkg', 'ext_pkg')"
+PYTHON -m coverage run coverage_test.py
+PYTHON -m coverage report
+"""
+
+######## setup.py ########
+from distutils.core import setup, Extension
+from Cython.Build import cythonize
+
+setup(ext_modules = cythonize([
+ 'pkg/*.pyx',
+]))
+
+setup(
+ name='ext_pkg',
+ package_dir={'': 'ext_src'},
+ ext_modules = cythonize([
+ Extension('ext_pkg._mul', ['ext_src/ext_pkg/mul.py'])
+ ]),
+)
+
+
+######## .coveragerc ########
+[run]
+plugins = Cython.Coverage
+
+
+######## pkg/__init__.py ########
+from .test_ext_import import test_add
+
+
+######## pkg/test_ext_import.pyx ########
+# cython: linetrace=True
+# distutils: define_macros=CYTHON_TRACE=1
+
+import ext_pkg
+
+
+cpdef test_add(int a, int b):
+ return a + ext_pkg.test_mul(b, 2)
+
+
+######## ext_src/ext_pkg/__init__.py ########
+from .mul import test_mul
+
+
+######## ext_src/ext_pkg/mul.py ########
+from __future__ import absolute_import
+
+
+def test_mul(a, b):
+ return a * b
+
+
+try:
+ from ._mul import *
+except ImportError:
+ pass
+
+
+######## coverage_test.py ########
+
+from pkg import test_add
+
+
+assert 5 == test_add(1, 2)
def test_lvalue_ref_assignment():
cdef vector[dpp] bar
cdef vector[vector[dp]] baz
- cdef vector[double] data
+ cdef vector[double] data = [0.0]
cdef dp bongle = &data[0]
bar.resize(1)