Imported Upstream version 0.29.3 upstream/0.29.3
authorDongHun Kwak <dh0128.kwak@samsung.com>
Thu, 31 Dec 2020 03:04:39 +0000 (12:04 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Thu, 31 Dec 2020 03:04:39 +0000 (12:04 +0900)
CHANGES.rst
Cython/Compiler/Code.py
Cython/Coverage.py
Cython/Shadow.py
Cython/Utility/Complex.c
Cython/Utility/ModuleSetupCode.c
Cython/Utility/StringTools.c
Cython/Utility/TypeConversion.c
docs/src/userguide/numpy_tutorial.rst
tests/run/coverage_installed_pkg.srctree [new file with mode: 0644]
tests/run/lvalue_refs.pyx

index 13e85ad2f7c7985fa1d081eb23c3447896e65cbd..a29750ffcffcd0ac0af14be0b6bb83d0285fdc7e 100644 (file)
@@ -2,6 +2,28 @@
 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)
 ===================
 
index 70639a40dcde4df1918ecfa4df95d4d5d6df1842..7595f5abf19c17a11cd759a0d6e06c60ab49b022 100644 (file)
@@ -906,9 +906,11 @@ class FunctionState(object):
         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):
         """
index f05e2b65066b2beb7d69712fbe01b6e6da58cd25..fa2f0ede1c06bc8d521beacb8d86b9ecdb890eba 100644 (file)
@@ -74,7 +74,7 @@ class Plugin(CoveragePlugin):
         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)
@@ -82,7 +82,9 @@ class Plugin(CoveragePlugin):
             #        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 = {}
index cdeddc35466f4ace7b46e19d9e096a7a0103b657..4ac0150eeca51dd985cddad42aefe2b989e6dc60 100644 (file)
@@ -1,7 +1,7 @@
 # cython.* namespace for pure mode.
 from __future__ import absolute_import
 
-__version__ = "0.29.2"
+__version__ = "0.29.3"
 
 try:
     from __builtin__ import basestring
index fc37c03769d99b53b2686215be358a528a181ef2..2e2277231278e8e1482db7490f369b5c1c5a3dce 100644 (file)
@@ -275,7 +275,7 @@ static {{type}} __Pyx_PyComplex_As_{{type_name}}(PyObject* o) {
                     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);
index e49fbb06a908caab4f0107ee6f1c4b48d5c2c773..bc52ca204a390d131630fad9aaa417814fd8d4e1 100644 (file)
@@ -489,7 +489,7 @@ class __Pyx_FakeReference {
 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));
@@ -514,7 +514,7 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
 }
 // 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))
index 4862a25a52f417b25394aa5956090a7c7a17fa3c..8147778e52b54c08d32005a9f73f573502f8d466 100644 (file)
@@ -915,8 +915,8 @@ static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, char* chars,
 #else
     // non-CPython
     {
-        uval = NULL;
         PyObject *sign = NULL, *padding = NULL;
+        uval = NULL;
         if (uoffset > 0) {
             prepend_sign = !!prepend_sign;
             if (uoffset > prepend_sign) {
index 796c8bed9b9194dff4da654d718284ffc76206eb..2cddd6a765eb738c858db3a594997f1c771a672d 100644 (file)
@@ -730,14 +730,14 @@ static CYTHON_INLINE PyObject* {{TO_PY_FUNCTION}}({{TYPE}} value, Py_ssize_t wid
             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':
index df1863d16e0619dab5c4d1ad43f3e90bb7ab3811..3d1cd5a743843c0c0c8cdad6093d65084a8da23c 100644 (file)
@@ -161,8 +161,8 @@ Cython version -- Cython uses ``.pyx`` as its file suffix (but it can also compi
 
 .. 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.
 
diff --git a/tests/run/coverage_installed_pkg.srctree b/tests/run/coverage_installed_pkg.srctree
new file mode 100644 (file)
index 0000000..7d70f7a
--- /dev/null
@@ -0,0 +1,71 @@
+# 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)
index 7e3b4df283ef67ce7a7ebda8003befba0cc24f26..d42f2407efa3c88275dcb32f90b50ba07ad2ddd8 100644 (file)
@@ -15,7 +15,7 @@ cdef void foo(vector[dpp] &bar, vector[vector[dp]] &baz) nogil:
 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)