Imported Upstream version 0.29.12 upstream/0.29.12
authorDongHun Kwak <dh0128.kwak@samsung.com>
Thu, 31 Dec 2020 03:10:31 +0000 (12:10 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Thu, 31 Dec 2020 03:10:31 +0000 (12:10 +0900)
CHANGES.rst
Cython/Compiler/Code.py
Cython/Compiler/ModuleNode.py
Cython/Compiler/Pythran.py
Cython/Shadow.py
Cython/Utility/ModuleSetupCode.c
Cython/Utility/ObjectHandling.c
tests/run/error_pos.srctree [new file with mode: 0644]

index 7f37af2c37264bd4136518b49a3bf66d62e6154a..25fb97f1241b4458ea9bbda827de8d68ea185c67 100644 (file)
@@ -2,13 +2,32 @@
 Cython Changelog
 ================
 
+0.29.12 (2019-07-07)
+====================
+
+Bugs fixed
+----------
+
+* Fix compile error in CPython 3.8b2 regarding the ``PyCode_New()`` signature.
+  (Github issue #3031)
+
+* Fix a C compiler warning about a missing ``int`` downcast.
+  (Github issue #3028)
+
+* Fix reported error positions of undefined builtins and constants.
+  Patch by Orivej Desh.  (Github issue #3030)
+
+* A 32 bit issue in the Pythran support was resolved.
+  Patch by Serge Guelton.  (Github issue #3032)
+
+
 0.29.11 (2019-06-30)
 ====================
 
 Bugs fixed
 ----------
 
-* Fix compile error in CPython 3.8b2.
+* Fix compile error in CPython 3.8b2 regarding the ``PyCode_New()`` signature.
   Patch by Nick Coghlan. (Github issue #3009)
 
 * Invalid C code generated for lambda functions in cdef methods.
index ee6ffd56f04e04985fb2a9b75b03998b4dc18263..1f04c48be037240188d2f0481467e12ce970710a 100644 (file)
@@ -2357,6 +2357,8 @@ class CCodeWriter(object):
     def error_goto(self, pos):
         lbl = self.funcstate.error_label
         self.funcstate.use_label(lbl)
+        if pos is None:
+            return 'goto %s;' % lbl
         return "__PYX_ERR(%s, %s, %s)" % (
             self.lookup_filename(pos[0]),
             pos[1],
index ab048426edee1dd64e6ff047ea901023e72be65d..ece046f97deac824c1ded83070ab752339b0380e 100644 (file)
@@ -2416,10 +2416,10 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
 
         if Options.cache_builtins:
             code.putln("/*--- Builtin init code ---*/")
-            code.put_error_if_neg(self.pos, "__Pyx_InitCachedBuiltins()")
+            code.put_error_if_neg(None, "__Pyx_InitCachedBuiltins()")
 
         code.putln("/*--- Constants init code ---*/")
-        code.put_error_if_neg(self.pos, "__Pyx_InitCachedConstants()")
+        code.put_error_if_neg(None, "__Pyx_InitCachedConstants()")
 
         code.putln("/*--- Global type/function init code ---*/")
 
index 7114d70ff31ccb02b4cb789504f096b8ba8fb965..76d7ca4097690779b1a180608a1929d198f91a8c 100644 (file)
@@ -43,7 +43,7 @@ def pythran_type(Ty, ptype="ndarray"):
         if pythran_is_pre_0_9:
             return "pythonic::types::%s<%s,%d>" % (ptype,ctype, ndim)
         else:
-            return "pythonic::types::%s<%s,pythonic::types::pshape<%s>>" % (ptype,ctype, ",".join(("Py_ssize_t",)*ndim))
+            return "pythonic::types::%s<%s,pythonic::types::pshape<%s>>" % (ptype,ctype, ",".join(("long",)*ndim))
     if Ty.is_pythran_expr:
         return Ty.pythran_type
     #if Ty.is_none:
index c8820eab76702704b861bf79941e5c72507f8ebc..b7cea05619ad352d401bb1d857e111c7ee3ae998 100644 (file)
@@ -1,7 +1,7 @@
 # cython.* namespace for pure mode.
 from __future__ import absolute_import
 
-__version__ = "0.29.11"
+__version__ = "0.29.12"
 
 try:
     from __builtin__ import basestring
index 5df55847123deef81427e8ba1e7f66c597503c46..8cd4833be37c410a63c90d8b62214f2547402995 100644 (file)
@@ -381,15 +381,12 @@ class __Pyx_FakeReference {
   #define __Pyx_DefaultClassType PyClass_Type
 #else
   #define __Pyx_BUILTIN_MODULE_NAME "builtins"
-#if PY_VERSION_HEX < 0x030800A4
+#if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
-          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
-#elif PY_VERSION_HEX >= 0x030800B2
-  #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
-          PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
+          PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
 #else
   #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
-          PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
+          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
 #endif
   #define __Pyx_DefaultClassType PyType_Type
 #endif
index 612d041bd71a848c8ba035c02f135f3b11e05e25..bf6f9532274be5b5033c6f8a632d24a5c5a322f3 100644 (file)
@@ -1933,7 +1933,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject
 
 // let's assume that the non-public C-API function might still change during the 3.6 beta phase
 #if 1 || PY_VERSION_HEX < 0x030600B1
-static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs);
+static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
 #else
 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
 #endif
@@ -2014,7 +2014,7 @@ static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args
 
 
 #if 1 || PY_VERSION_HEX < 0x030600B1
-static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) {
+static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
     PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
     PyObject *globals = PyFunction_GET_GLOBALS(func);
     PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
@@ -2108,12 +2108,12 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args,
     //#elif PY_MAJOR_VERSION >= 3
 #if PY_MAJOR_VERSION >= 3
     result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
-                               args, nargs,
+                               args, (int)nargs,
                                k, (int)nk,
                                d, (int)nd, kwdefs, closure);
 #else
     result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
-                               args, nargs,
+                               args, (int)nargs,
                                k, (int)nk,
                                d, (int)nd, closure);
 #endif
diff --git a/tests/run/error_pos.srctree b/tests/run/error_pos.srctree
new file mode 100644 (file)
index 0000000..fd7323a
--- /dev/null
@@ -0,0 +1,24 @@
+PYTHON setup.py build_ext --inplace
+PYTHON test_error_pos.py
+
+######## setup.py ###########
+from distutils.core import setup
+from Cython.Build import cythonize
+
+setup(ext_modules=cythonize("error_pos.pyx"))
+
+######## error_pos.pyx ###########
+from os import *
+
+abcdefg(line)
+
+######## test_error_pos.py ###########
+import subprocess
+import sys
+
+cmd = [sys.executable, '-c', 'import error_pos']
+proc = subprocess.Popen(cmd, stderr=subprocess.PIPE)
+_, err = proc.communicate()
+# The error should contain the line number and the line text where the
+# undefined identifier is used.
+assert b'line 3, in init error_pos' and b'abcdefg(line)' in err, err