Hello community, here is the log from the commit of package python-Cython for openSUSE:Factory checked in at 2020-02-22 19:02:28 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-Cython (Old) and /work/SRC/openSUSE:Factory/.python-Cython.new.26092 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-Cython" Sat Feb 22 19:02:28 2020 rev:52 rq:775286 version:0.29.15 Changes: -------- --- /work/SRC/openSUSE:Factory/python-Cython/python-Cython.changes 2019-11-22 10:25:11.881277551 +0100 +++ /work/SRC/openSUSE:Factory/.python-Cython.new.26092/python-Cython.changes 2020-02-22 19:02:51.397920314 +0100 @@ -1,0 +2,11 @@ +Tue Feb 18 16:45:37 UTC 2020 - Ondřej Súkup <[email protected]> + +- update to 0.29.15 + * Crash when returning a temporary Python object from an async-def function. + * Crash when using **kwargs in generators. + * Double reference free in __class__ cell handling for super() calls. + * Compile error when using *args as Python class bases. + * Fixed C name collision in the auto-pickle code + * Deprecated import failed in Python 3.9 + +------------------------------------------------------------------- Old: ---- Cython-0.29.14.tar.gz New: ---- Cython-0.29.15.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-Cython.spec ++++++ --- /var/tmp/diff_new_pack.473Lmr/_old 2020-02-22 19:02:52.281922026 +0100 +++ /var/tmp/diff_new_pack.473Lmr/_new 2020-02-22 19:02:52.297922057 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-Cython # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define oldpython python Name: python-Cython -Version: 0.29.14 +Version: 0.29.15 Release: 0 Summary: The Cython compiler for writing C extensions for the Python language License: Apache-2.0 ++++++ Cython-0.29.14.tar.gz -> Cython-0.29.15.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.14/.gitrev new/Cython-0.29.15/.gitrev --- old/Cython-0.29.14/.gitrev 2019-11-01 17:46:03.000000000 +0100 +++ new/Cython-0.29.15/.gitrev 2020-02-06 11:27:36.000000000 +0100 @@ -1 +1 @@ -bfcaf163e3dcf472ef2af5dec6ac3fffd0d34e66 +26cb654dcf4ed1b1858daf16b39fd13406b1ac64 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.14/CHANGES.rst new/Cython-0.29.15/CHANGES.rst --- old/Cython-0.29.14/CHANGES.rst 2019-11-01 15:13:39.000000000 +0100 +++ new/Cython-0.29.15/CHANGES.rst 2020-02-06 11:26:34.000000000 +0100 @@ -2,6 +2,31 @@ Cython Changelog ================ +0.29.15 (2020-02-06) +==================== + +* Crash when returning a temporary Python object from an async-def function. + (Github issue #3337) + +* Crash when using ``**kwargs`` in generators. + Patch by David Woods. (Github issue #3265) + +* Double reference free in ``__class__`` cell handling for ``super()`` calls. + (Github issue #3246) + +* Compile error when using ``*args`` as Python class bases. + (Github issue #3338) + +* Import failure in IPython 7.11. + (Github issue #3297) + +* Fixed C name collision in the auto-pickle code. + Patch by ThePrez. (Github issue #3238) + +* Deprecated import failed in Python 3.9. + (Github issue #3266) + + 0.29.14 (2019-11-01) ==================== @@ -9,7 +34,7 @@ ---------- * The generated code failed to initialise the ``tp_print`` slot in CPython 3.8. - Patches by Pablo Galindo and Orivej Desh (Github issues #3171, #3201). + Patches by Pablo Galindo and Orivej Desh. (Github issues #3171, #3201) * ``?`` for ``bool`` was missing from the supported NumPy dtypes. Patch by Max Klein. (Github issue #2675) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.14/Cython/Build/Dependencies.py new/Cython-0.29.15/Cython/Build/Dependencies.py --- old/Cython-0.29.14/Cython/Build/Dependencies.py 2019-06-30 08:50:51.000000000 +0200 +++ new/Cython-0.29.15/Cython/Build/Dependencies.py 2020-02-06 11:26:34.000000000 +0100 @@ -19,6 +19,11 @@ import zipfile try: + from collections.abc import Iterable +except ImportError: + from collections import Iterable + +try: import gzip gzip_open = gzip.open gzip_ext = '.gz' @@ -749,7 +754,7 @@ exclude = [] if patterns is None: return [], {} - elif isinstance(patterns, basestring) or not isinstance(patterns, collections.Iterable): + elif isinstance(patterns, basestring) or not isinstance(patterns, Iterable): patterns = [patterns] explicit_modules = set([m.name for m in patterns if isinstance(m, Extension)]) seen = set() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.14/Cython/Build/IpythonMagic.py new/Cython-0.29.15/Cython/Build/IpythonMagic.py --- old/Cython-0.29.14/Cython/Build/IpythonMagic.py 2019-11-01 15:13:39.000000000 +0100 +++ new/Cython-0.29.15/Cython/Build/IpythonMagic.py 2020-02-06 11:26:34.000000000 +0100 @@ -56,6 +56,8 @@ import distutils.log import textwrap +IO_ENCODING = sys.getfilesystemencoding() +IS_PY2 = sys.version_info[0] < 3 try: reload @@ -73,7 +75,6 @@ from IPython.core import display from IPython.core import magic_arguments from IPython.core.magic import Magics, magics_class, cell_magic -from IPython.utils import py3compat try: from IPython.paths import get_ipython_cache_dir except ImportError: @@ -101,6 +102,14 @@ PGO_CONFIG['mingw32'] = PGO_CONFIG['gcc'] +if IS_PY2: + def encode_fs(name): + return name if isinstance(name, bytes) else name.encode(IO_ENCODING) +else: + def encode_fs(name): + return name + + @magics_class class CythonMagics(Magics): @@ -306,7 +315,7 @@ key += (time.time(),) if args.name: - module_name = py3compat.unicode_to_str(args.name) + module_name = str(args.name) # no-op in Py3 else: module_name = "_cython_magic_" + hashlib.md5(str(key).encode('utf-8')).hexdigest() html_file = os.path.join(lib_dir, module_name + '.html') @@ -406,7 +415,7 @@ def _cythonize(self, module_name, code, lib_dir, args, quiet=True): pyx_file = os.path.join(lib_dir, module_name + '.pyx') - pyx_file = py3compat.cast_bytes_py2(pyx_file, encoding=sys.getfilesystemencoding()) + pyx_file = encode_fs(pyx_file) c_include_dirs = args.include c_src_files = list(map(str, args.src)) @@ -526,10 +535,10 @@ build_extension = _build_ext(dist) build_extension.finalize_options() if temp_dir: - temp_dir = py3compat.cast_bytes_py2(temp_dir, encoding=sys.getfilesystemencoding()) + temp_dir = encode_fs(temp_dir) build_extension.build_temp = temp_dir if lib_dir: - lib_dir = py3compat.cast_bytes_py2(lib_dir, encoding=sys.getfilesystemencoding()) + lib_dir = encode_fs(lib_dir) build_extension.build_lib = lib_dir if extension is not None: build_extension.extensions = [extension] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.14/Cython/Build/Tests/TestIpythonMagic.py new/Cython-0.29.15/Cython/Build/Tests/TestIpythonMagic.py --- old/Cython-0.29.14/Cython/Build/Tests/TestIpythonMagic.py 2018-09-22 16:18:56.000000000 +0200 +++ new/Cython-0.29.15/Cython/Build/Tests/TestIpythonMagic.py 2020-02-06 11:26:34.000000000 +0100 @@ -13,15 +13,8 @@ try: import IPython.testing.globalipapp - from IPython.utils import py3compat except ImportError: # Disable tests and fake helpers for initialisation below. - class _py3compat(object): - def str_to_unicode(self, s): - return s - - py3compat = _py3compat() - def skip_if_not_installed(_): return None else: @@ -35,24 +28,24 @@ except ImportError: pass -code = py3compat.str_to_unicode("""\ +code = u"""\ def f(x): return 2*x -""") +""" -cython3_code = py3compat.str_to_unicode("""\ +cython3_code = u"""\ def f(int x): return 2 / x def call(x): return f(*(x,)) -""") +""" -pgo_cython3_code = cython3_code + py3compat.str_to_unicode("""\ +pgo_cython3_code = cython3_code + u"""\ def main(): for _ in range(100): call(5) main() -""") +""" if sys.platform == 'win32': @@ -161,10 +154,10 @@ @skip_win32('Skip on Windows') def test_extlibs(self): ip = self._ip - code = py3compat.str_to_unicode(""" + code = u""" from libc.math cimport sin x = sin(0.0) - """) + """ ip.user_ns['x'] = 1 ip.run_cell_magic('cython', '-l m', code) self.assertEqual(ip.user_ns['x'], 0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.14/Cython/Compiler/ExprNodes.py new/Cython-0.29.15/Cython/Compiler/ExprNodes.py --- old/Cython-0.29.14/Cython/Compiler/ExprNodes.py 2019-05-28 21:54:08.000000000 +0200 +++ new/Cython-0.29.15/Cython/Compiler/ExprNodes.py 2020-02-06 11:26:34.000000000 +0100 @@ -8938,12 +8938,11 @@ # a name, tuple of bases and class dictionary. # # name EncodedString Name of the class - # bases ExprNode Base class tuple - # dict ExprNode Class dict (not owned by this node) + # class_def_node PyClassDefNode PyClassDefNode defining this class # doc ExprNode or None Doc string # module_name EncodedString Name of defining module - subexprs = ['bases', 'doc'] + subexprs = ['doc'] type = py_object_type is_temp = True @@ -8952,7 +8951,6 @@ return py_object_type def analyse_types(self, env): - self.bases = self.bases.analyse_types(env) if self.doc: self.doc = self.doc.analyse_types(env) self.doc = self.doc.coerce_to_pyobject(env) @@ -8965,12 +8963,13 @@ gil_message = "Constructing Python class" def generate_result_code(self, code): + class_def_node = self.class_def_node cname = code.intern_identifier(self.name) if self.doc: code.put_error_if_neg(self.pos, 'PyDict_SetItem(%s, %s, %s)' % ( - self.dict.py_result(), + class_def_node.dict.py_result(), code.intern_identifier( StringEncoding.EncodedString("__doc__")), self.doc.py_result())) @@ -8979,8 +8978,8 @@ code.putln( '%s = __Pyx_CreateClass(%s, %s, %s, %s, %s); %s' % ( self.result(), - self.bases.py_result(), - self.dict.py_result(), + class_def_node.bases.py_result(), + class_def_node.dict.py_result(), cname, qualname, py_mod_name, @@ -8994,8 +8993,8 @@ # a name, tuple of bases and class dictionary. # # name EncodedString Name of the class - # dict ExprNode Class dict (not owned by this node) # module_name EncodedString Name of defining module + # class_def_node PyClassDefNode PyClassDefNode defining this class # calculate_metaclass bool should call CalculateMetaclass() # allow_py2_metaclass bool should look for Py2 metaclass @@ -9018,12 +9017,10 @@ def generate_result_code(self, code): code.globalstate.use_utility_code(UtilityCode.load_cached("Py3ClassCreate", "ObjectHandling.c")) cname = code.intern_identifier(self.name) - if self.mkw: - mkw = self.mkw.py_result() - else: - mkw = 'NULL' - if self.metaclass: - metaclass = self.metaclass.py_result() + class_def_node = self.class_def_node + mkw = class_def_node.mkw.py_result() if class_def_node.mkw else 'NULL' + if class_def_node.metaclass: + metaclass = class_def_node.metaclass.py_result() else: metaclass = "((PyObject*)&__Pyx_DefaultClassType)" code.putln( @@ -9031,8 +9028,8 @@ self.result(), metaclass, cname, - self.bases.py_result(), - self.dict.py_result(), + class_def_node.bases.py_result(), + class_def_node.dict.py_result(), mkw, self.calculate_metaclass, self.allow_py2_metaclass, @@ -9043,8 +9040,7 @@ class PyClassMetaclassNode(ExprNode): # Helper class holds Python3 metaclass object # - # bases ExprNode Base class tuple (not owned by this node) - # mkw ExprNode Class keyword arguments (not owned by this node) + # class_def_node PyClassDefNode PyClassDefNode defining this class subexprs = [] @@ -9057,38 +9053,38 @@ return True def generate_result_code(self, code): - if self.mkw: + bases = self.class_def_node.bases + mkw = self.class_def_node.mkw + if mkw: code.globalstate.use_utility_code( UtilityCode.load_cached("Py3MetaclassGet", "ObjectHandling.c")) call = "__Pyx_Py3MetaclassGet(%s, %s)" % ( - self.bases.result(), - self.mkw.result()) + bases.result(), + mkw.result()) else: code.globalstate.use_utility_code( UtilityCode.load_cached("CalculateMetaclass", "ObjectHandling.c")) call = "__Pyx_CalculateMetaclass(NULL, %s)" % ( - self.bases.result()) + bases.result()) code.putln( "%s = %s; %s" % ( self.result(), call, code.error_goto_if_null(self.result(), self.pos))) code.put_gotref(self.py_result()) + class PyClassNamespaceNode(ExprNode, ModuleNameMixin): # Helper class holds Python3 namespace object # # All this are not owned by this node - # metaclass ExprNode Metaclass object - # bases ExprNode Base class tuple - # mkw ExprNode Class keyword arguments + # class_def_node PyClassDefNode PyClassDefNode defining this class # doc ExprNode or None Doc string (owned) subexprs = ['doc'] def analyse_types(self, env): if self.doc: - self.doc = self.doc.analyse_types(env) - self.doc = self.doc.coerce_to_pyobject(env) + self.doc = self.doc.analyse_types(env).coerce_to_pyobject(env) self.type = py_object_type self.is_temp = 1 return self @@ -9100,23 +9096,16 @@ cname = code.intern_identifier(self.name) py_mod_name = self.get_py_mod_name(code) qualname = self.get_py_qualified_name(code) - if self.doc: - doc_code = self.doc.result() - else: - doc_code = '(PyObject *) NULL' - if self.mkw: - mkw = self.mkw.py_result() - else: - mkw = '(PyObject *) NULL' - if self.metaclass: - metaclass = self.metaclass.py_result() - else: - metaclass = "(PyObject *) NULL" + class_def_node = self.class_def_node + null = "(PyObject *) NULL" + doc_code = self.doc.result() if self.doc else null + mkw = class_def_node.mkw.py_result() if class_def_node.mkw else null + metaclass = class_def_node.metaclass.py_result() if class_def_node.metaclass else null code.putln( "%s = __Pyx_Py3MetaclassPrepare(%s, %s, %s, %s, %s, %s, %s); %s" % ( self.result(), metaclass, - self.bases.result(), + class_def_node.bases.result(), cname, qualname, mkw, @@ -9136,21 +9125,20 @@ def analyse_expressions(self, env): return self - def generate_evaluation_code(self, code): - if self.is_active: - self.allocate_temp_result(code) - code.putln( - '%s = PyList_New(0); %s' % ( - self.result(), - code.error_goto_if_null(self.result(), self.pos))) - code.put_gotref(self.result()) + def generate_result_code(self, code): + assert self.is_active + code.putln( + '%s = PyList_New(0); %s' % ( + self.result(), + code.error_goto_if_null(self.result(), self.pos))) + code.put_gotref(self.result()) def generate_injection_code(self, code, classobj_cname): - if self.is_active: - code.globalstate.use_utility_code( - UtilityCode.load_cached("CyFunctionClassCell", "CythonFunction.c")) - code.put_error_if_neg(self.pos, '__Pyx_CyFunction_InitClassCell(%s, %s)' % ( - self.result(), classobj_cname)) + assert self.is_active + code.globalstate.use_utility_code( + UtilityCode.load_cached("CyFunctionClassCell", "CythonFunction.c")) + code.put_error_if_neg(self.pos, '__Pyx_CyFunction_InitClassCell(%s, %s)' % ( + self.result(), classobj_cname)) class ClassCellNode(ExprNode): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.14/Cython/Compiler/Nodes.py new/Cython-0.29.15/Cython/Compiler/Nodes.py --- old/Cython-0.29.14/Cython/Compiler/Nodes.py 2019-06-02 11:26:16.000000000 +0200 +++ new/Cython-0.29.15/Cython/Compiler/Nodes.py 2020-02-06 11:26:34.000000000 +0100 @@ -3232,8 +3232,14 @@ def put_into_closure(entry): if entry.in_closure: code.putln('%s = %s;' % (entry.cname, entry.original_cname)) - code.put_var_incref(entry) - code.put_var_giveref(entry) + if entry.xdecref_cleanup: + # mostly applies to the starstar arg - this can sometimes be NULL + # so must be xincrefed instead + code.put_var_xincref(entry) + code.put_var_xgiveref(entry) + else: + code.put_var_incref(entry) + code.put_var_giveref(entry) for arg in self.args: put_into_closure(arg.entry) for arg in self.star_arg, self.starstar_arg: @@ -4497,26 +4503,22 @@ pass # no base classes => no inherited metaclass else: self.metaclass = ExprNodes.PyClassMetaclassNode( - pos, mkw=mkdict, bases=self.bases) + pos, class_def_node=self) needs_metaclass_calculation = False else: needs_metaclass_calculation = True self.dict = ExprNodes.PyClassNamespaceNode( - pos, name=name, doc=doc_node, - metaclass=self.metaclass, bases=self.bases, mkw=self.mkw) + pos, name=name, doc=doc_node, class_def_node=self) self.classobj = ExprNodes.Py3ClassNode( - pos, name=name, - bases=self.bases, dict=self.dict, doc=doc_node, - metaclass=self.metaclass, mkw=self.mkw, + pos, name=name, class_def_node=self, doc=doc_node, calculate_metaclass=needs_metaclass_calculation, allow_py2_metaclass=allow_py2_metaclass) else: # no bases, no metaclass => old style class creation self.dict = ExprNodes.DictNode(pos, key_value_pairs=[]) self.classobj = ExprNodes.ClassNode( - pos, name=name, - bases=bases, dict=self.dict, doc=doc_node) + pos, name=name, class_def_node=self, doc=doc_node) self.target = ExprNodes.NameNode(pos, name=name) self.class_cell = ExprNodes.ClassCellInjectorNode(self.pos) @@ -4534,7 +4536,7 @@ visibility='private', module_name=None, class_name=self.name, - bases=self.classobj.bases or ExprNodes.TupleNode(self.pos, args=[]), + bases=self.bases or ExprNodes.TupleNode(self.pos, args=[]), decorators=self.decorators, body=self.body, in_pxd=False, @@ -4558,6 +4560,10 @@ args=[class_result]) self.decorators = None self.class_result = class_result + if self.bases: + self.bases.analyse_declarations(env) + if self.mkw: + self.mkw.analyse_declarations(env) self.class_result.analyse_declarations(env) self.target.analyse_target_declaration(env) cenv = self.create_scope(env) @@ -4568,10 +4574,10 @@ def analyse_expressions(self, env): if self.bases: self.bases = self.bases.analyse_expressions(env) - if self.metaclass: - self.metaclass = self.metaclass.analyse_expressions(env) if self.mkw: self.mkw = self.mkw.analyse_expressions(env) + if self.metaclass: + self.metaclass = self.metaclass.analyse_expressions(env) self.dict = self.dict.analyse_expressions(env) self.class_result = self.class_result.analyse_expressions(env) cenv = self.scope @@ -4596,12 +4602,22 @@ self.metaclass.generate_evaluation_code(code) self.dict.generate_evaluation_code(code) cenv.namespace_cname = cenv.class_obj_cname = self.dict.result() - self.class_cell.generate_evaluation_code(code) + + class_cell = self.class_cell + if class_cell is not None and not class_cell.is_active: + class_cell = None + + if class_cell is not None: + class_cell.generate_evaluation_code(code) self.body.generate_execution_code(code) self.class_result.generate_evaluation_code(code) - self.class_cell.generate_injection_code( - code, self.class_result.result()) - self.class_cell.generate_disposal_code(code) + if class_cell is not None: + class_cell.generate_injection_code( + code, self.class_result.result()) + if class_cell is not None: + class_cell.generate_disposal_code(code) + class_cell.free_temps(code) + cenv.namespace_cname = cenv.class_obj_cname = self.classobj.result() self.target.generate_assignment_code(self.class_result, code) self.dict.generate_disposal_code(code) @@ -5980,6 +5996,7 @@ rhs=value, code=code, have_gil=self.in_nogil_context) + value.generate_post_assignment_code(code) elif self.in_generator: # return value == raise StopIteration(value), but uncatchable code.globalstate.use_utility_code( @@ -5993,7 +6010,7 @@ code.putln("%s = %s;" % ( Naming.retval_cname, value.result_as(self.return_type))) - value.generate_post_assignment_code(code) + value.generate_post_assignment_code(code) value.free_temps(code) else: if self.return_type.is_pyobject: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.14/Cython/Shadow.py new/Cython-0.29.15/Cython/Shadow.py --- old/Cython-0.29.14/Cython/Shadow.py 2019-11-01 15:13:39.000000000 +0100 +++ new/Cython-0.29.15/Cython/Shadow.py 2020-02-06 11:26:34.000000000 +0100 @@ -1,7 +1,7 @@ # cython.* namespace for pure mode. from __future__ import absolute_import -__version__ = "0.29.14" +__version__ = "0.29.15" try: from __builtin__ import basestring diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.14/Cython/Utility/ExtensionTypes.c new/Cython-0.29.15/Cython/Utility/ExtensionTypes.c --- old/Cython-0.29.14/Cython/Utility/ExtensionTypes.c 2018-09-22 16:18:56.000000000 +0200 +++ new/Cython-0.29.15/Cython/Utility/ExtensionTypes.c 2020-02-06 11:26:34.000000000 +0100 @@ -166,49 +166,49 @@ PyObject *setstate_cython = NULL; #if CYTHON_USE_PYTYPE_LOOKUP - if (_PyType_Lookup((PyTypeObject*)type_obj, PYIDENT("__getstate__"))) goto GOOD; + if (_PyType_Lookup((PyTypeObject*)type_obj, PYIDENT("__getstate__"))) goto __PYX_GOOD; #else - if (PyObject_HasAttr(type_obj, PYIDENT("__getstate__"))) goto GOOD; + if (PyObject_HasAttr(type_obj, PYIDENT("__getstate__"))) goto __PYX_GOOD; #endif #if CYTHON_USE_PYTYPE_LOOKUP - object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, PYIDENT("__reduce_ex__")); if (!object_reduce_ex) goto BAD; + object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, PYIDENT("__reduce_ex__")); if (!object_reduce_ex) goto __PYX_BAD; #else - object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, PYIDENT("__reduce_ex__")); if (!object_reduce_ex) goto BAD; + object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, PYIDENT("__reduce_ex__")); if (!object_reduce_ex) goto __PYX_BAD; #endif - reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, PYIDENT("__reduce_ex__")); if (unlikely(!reduce_ex)) goto BAD; + reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, PYIDENT("__reduce_ex__")); if (unlikely(!reduce_ex)) goto __PYX_BAD; if (reduce_ex == object_reduce_ex) { #if CYTHON_USE_PYTYPE_LOOKUP - object_reduce = _PyType_Lookup(&PyBaseObject_Type, PYIDENT("__reduce__")); if (!object_reduce) goto BAD; + object_reduce = _PyType_Lookup(&PyBaseObject_Type, PYIDENT("__reduce__")); if (!object_reduce) goto __PYX_BAD; #else - object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, PYIDENT("__reduce__")); if (!object_reduce) goto BAD; + object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, PYIDENT("__reduce__")); if (!object_reduce) goto __PYX_BAD; #endif - reduce = __Pyx_PyObject_GetAttrStr(type_obj, PYIDENT("__reduce__")); if (unlikely(!reduce)) goto BAD; + reduce = __Pyx_PyObject_GetAttrStr(type_obj, PYIDENT("__reduce__")); if (unlikely(!reduce)) goto __PYX_BAD; if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, PYIDENT("__reduce_cython__"))) { - reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, PYIDENT("__reduce_cython__")); if (unlikely(!reduce_cython)) goto BAD; - ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, PYIDENT("__reduce__"), reduce_cython); if (unlikely(ret < 0)) goto BAD; - ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, PYIDENT("__reduce_cython__")); if (unlikely(ret < 0)) goto BAD; + reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, PYIDENT("__reduce_cython__")); if (unlikely(!reduce_cython)) goto __PYX_BAD; + ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, PYIDENT("__reduce__"), reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, PYIDENT("__reduce_cython__")); if (unlikely(ret < 0)) goto __PYX_BAD; setstate = __Pyx_PyObject_GetAttrStr(type_obj, PYIDENT("__setstate__")); if (!setstate) PyErr_Clear(); if (!setstate || __Pyx_setup_reduce_is_named(setstate, PYIDENT("__setstate_cython__"))) { - setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, PYIDENT("__setstate_cython__")); if (unlikely(!setstate_cython)) goto BAD; - ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, PYIDENT("__setstate__"), setstate_cython); if (unlikely(ret < 0)) goto BAD; - ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, PYIDENT("__setstate_cython__")); if (unlikely(ret < 0)) goto BAD; + setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, PYIDENT("__setstate_cython__")); if (unlikely(!setstate_cython)) goto __PYX_BAD; + ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, PYIDENT("__setstate__"), setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, PYIDENT("__setstate_cython__")); if (unlikely(ret < 0)) goto __PYX_BAD; } PyType_Modified((PyTypeObject*)type_obj); } } - goto GOOD; + goto __PYX_GOOD; -BAD: +__PYX_BAD: if (!PyErr_Occurred()) PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name); ret = -1; -GOOD: +__PYX_GOOD: #if !CYTHON_USE_PYTYPE_LOOKUP Py_XDECREF(object_reduce); Py_XDECREF(object_reduce_ex); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.14/Cython/Utility/Overflow.c new/Cython-0.29.15/Cython/Utility/Overflow.c --- old/Cython-0.29.14/Cython/Utility/Overflow.c 2019-02-27 13:23:19.000000000 +0100 +++ new/Cython-0.29.15/Cython/Utility/Overflow.c 2020-02-06 11:26:34.000000000 +0100 @@ -20,10 +20,10 @@ /////////////// Common.proto /////////////// static int __Pyx_check_twos_complement(void) { - if (-1 != ~0) { + if ((-1 != ~0)) { PyErr_SetString(PyExc_RuntimeError, "Two's complement required for overflow checks."); return 1; - } else if (sizeof(short) == sizeof(int)) { + } else if ((sizeof(short) == sizeof(int))) { PyErr_SetString(PyExc_RuntimeError, "sizeof(short) < sizeof(int) required for overflow checks."); return 1; } else { @@ -31,11 +31,11 @@ } } -#define __PYX_IS_UNSIGNED(type) (((type) -1) > 0) -#define __PYX_SIGN_BIT(type) (((unsigned type) 1) << (sizeof(type) * 8 - 1)) -#define __PYX_HALF_MAX(type) (((type) 1) << (sizeof(type) * 8 - 2)) -#define __PYX_MIN(type) (__PYX_IS_UNSIGNED(type) ? (type) 0 : 0 - __PYX_HALF_MAX(type) - __PYX_HALF_MAX(type)) -#define __PYX_MAX(type) (~__PYX_MIN(type)) +#define __PYX_IS_UNSIGNED(type) ((((type) -1) > 0)) +#define __PYX_SIGN_BIT(type) ((((unsigned type) 1) << (sizeof(type) * 8 - 1))) +#define __PYX_HALF_MAX(type) ((((type) 1) << (sizeof(type) * 8 - 2))) +#define __PYX_MIN(type) ((__PYX_IS_UNSIGNED(type) ? (type) 0 : 0 - __PYX_HALF_MAX(type) - __PYX_HALF_MAX(type))) +#define __PYX_MAX(type) ((~__PYX_MIN(type))) #define __Pyx_add_no_overflow(a, b, overflow) ((a) + (b)) #define __Pyx_add_const_no_overflow(a, b, overflow) ((a) + (b)) @@ -82,13 +82,13 @@ } static CYTHON_INLINE {{UINT}} __Pyx_mul_{{NAME}}_checking_overflow({{UINT}} a, {{UINT}} b, int *overflow) { - if (sizeof({{UINT}}) < sizeof(unsigned long)) { + if ((sizeof({{UINT}}) < sizeof(unsigned long))) { unsigned long big_r = ((unsigned long) a) * ((unsigned long) b); {{UINT}} r = ({{UINT}}) big_r; *overflow |= big_r != r; return r; #ifdef HAVE_LONG_LONG - } else if (sizeof({{UINT}}) < sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof({{UINT}}) < sizeof(unsigned PY_LONG_LONG))) { unsigned PY_LONG_LONG big_r = ((unsigned PY_LONG_LONG) a) * ((unsigned PY_LONG_LONG) b); {{UINT}} r = ({{UINT}}) big_r; *overflow |= big_r != r; @@ -138,13 +138,13 @@ /////////////// BaseCaseSigned /////////////// static CYTHON_INLINE {{INT}} __Pyx_add_{{NAME}}_checking_overflow({{INT}} a, {{INT}} b, int *overflow) { - if (sizeof({{INT}}) < sizeof(long)) { + if ((sizeof({{INT}}) < sizeof(long))) { long big_r = ((long) a) + ((long) b); {{INT}} r = ({{INT}}) big_r; *overflow |= big_r != r; return r; #ifdef HAVE_LONG_LONG - } else if (sizeof({{INT}}) < sizeof(PY_LONG_LONG)) { + } else if ((sizeof({{INT}}) < sizeof(PY_LONG_LONG))) { PY_LONG_LONG big_r = ((PY_LONG_LONG) a) + ((PY_LONG_LONG) b); {{INT}} r = ({{INT}}) big_r; *overflow |= big_r != r; @@ -184,13 +184,13 @@ } static CYTHON_INLINE {{INT}} __Pyx_mul_{{NAME}}_checking_overflow({{INT}} a, {{INT}} b, int *overflow) { - if (sizeof({{INT}}) < sizeof(long)) { + if ((sizeof({{INT}}) < sizeof(long))) { long big_r = ((long) a) * ((long) b); {{INT}} r = ({{INT}}) big_r; *overflow |= big_r != r; return ({{INT}}) r; #ifdef HAVE_LONG_LONG - } else if (sizeof({{INT}}) < sizeof(PY_LONG_LONG)) { + } else if ((sizeof({{INT}}) < sizeof(PY_LONG_LONG))) { PY_LONG_LONG big_r = ((PY_LONG_LONG) a) * ((PY_LONG_LONG) b); {{INT}} r = ({{INT}}) big_r; *overflow |= big_r != r; @@ -240,11 +240,11 @@ /////////////// SizeCheck.proto /////////////// static int __Pyx_check_sane_{{NAME}}(void) { - if (sizeof({{TYPE}}) <= sizeof(int) || + if (((sizeof({{TYPE}}) <= sizeof(int)) || #ifdef HAVE_LONG_LONG - sizeof({{TYPE}}) == sizeof(PY_LONG_LONG) || + (sizeof({{TYPE}}) == sizeof(PY_LONG_LONG)) || #endif - sizeof({{TYPE}}) == sizeof(long)) { + (sizeof({{TYPE}}) == sizeof(long)))) { return 0; } else { PyErr_Format(PyExc_RuntimeError, \ @@ -261,27 +261,27 @@ /////////////// Binop /////////////// static CYTHON_INLINE {{TYPE}} __Pyx_{{BINOP}}_{{NAME}}_checking_overflow({{TYPE}} a, {{TYPE}} b, int *overflow) { - if (sizeof({{TYPE}}) < sizeof(int)) { + if ((sizeof({{TYPE}}) < sizeof(int))) { return __Pyx_{{BINOP}}_no_overflow(a, b, overflow); } else if (__PYX_IS_UNSIGNED({{TYPE}})) { - if (sizeof({{TYPE}}) == sizeof(unsigned int)) { + if ((sizeof({{TYPE}}) == sizeof(unsigned int))) { return __Pyx_{{BINOP}}_unsigned_int_checking_overflow(a, b, overflow); - } else if (sizeof({{TYPE}}) == sizeof(unsigned long)) { + } else if ((sizeof({{TYPE}}) == sizeof(unsigned long))) { return __Pyx_{{BINOP}}_unsigned_long_checking_overflow(a, b, overflow); #ifdef HAVE_LONG_LONG - } else if (sizeof({{TYPE}}) == sizeof(unsigned PY_LONG_LONG)) { + } else if ((sizeof({{TYPE}}) == sizeof(unsigned PY_LONG_LONG))) { return __Pyx_{{BINOP}}_unsigned_long_long_checking_overflow(a, b, overflow); #endif } else { abort(); return 0; /* handled elsewhere */ } } else { - if (sizeof({{TYPE}}) == sizeof(int)) { + if ((sizeof({{TYPE}}) == sizeof(int))) { return __Pyx_{{BINOP}}_int_checking_overflow(a, b, overflow); - } else if (sizeof({{TYPE}}) == sizeof(long)) { + } else if ((sizeof({{TYPE}}) == sizeof(long))) { return __Pyx_{{BINOP}}_long_checking_overflow(a, b, overflow); #ifdef HAVE_LONG_LONG - } else if (sizeof({{TYPE}}) == sizeof(PY_LONG_LONG)) { + } else if ((sizeof({{TYPE}}) == sizeof(PY_LONG_LONG))) { return __Pyx_{{BINOP}}_long_long_checking_overflow(a, b, overflow); #endif } else { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.14/PKG-INFO new/Cython-0.29.15/PKG-INFO --- old/Cython-0.29.14/PKG-INFO 2019-11-01 17:46:04.000000000 +0100 +++ new/Cython-0.29.15/PKG-INFO 2020-02-06 11:27:44.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: Cython -Version: 0.29.14 +Version: 0.29.15 Summary: The Cython compiler for writing C extensions for the Python language. Home-page: http://cython.org/ Author: Robert Bradshaw, Stefan Behnel, Dag Seljebotn, Greg Ewing, et al. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.14/runtests.py new/Cython-0.29.15/runtests.py --- old/Cython-0.29.14/runtests.py 2019-06-30 08:50:51.000000000 +0200 +++ new/Cython-0.29.15/runtests.py 2020-02-06 11:26:34.000000000 +0100 @@ -1913,13 +1913,13 @@ def check_thread_termination(ignore_seen=True): if threading is None: # no threading enabled in CPython return - current = threading.currentThread() + current = threading.current_thread() blocking_threads = [] for t in threading.enumerate(): - if not t.isAlive() or t == current or t.name == 'time_stamper': + if not t.is_alive() or t == current or t.name == 'time_stamper': continue t.join(timeout=2) - if t.isAlive(): + if t.is_alive(): if not ignore_seen: blocking_threads.append(t) continue diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.14/tests/run/async_def.pyx new/Cython-0.29.15/tests/run/async_def.pyx --- old/Cython-0.29.14/tests/run/async_def.pyx 1970-01-01 01:00:00.000000000 +0100 +++ new/Cython-0.29.15/tests/run/async_def.pyx 2020-02-06 11:26:34.000000000 +0100 @@ -0,0 +1,35 @@ +# cython: language_level=3, binding=True +# mode: run +# tag: pep492, await, gh3337 + +""" +Cython specific tests in addition to "test_coroutines_pep492.pyx" +(which is copied from CPython). +""" + +import sys + + +def run_async(coro): + #assert coro.__class__ is types.GeneratorType + assert coro.__class__.__name__ in ('coroutine', '_GeneratorWrapper'), coro.__class__.__name__ + + buffer = [] + result = None + while True: + try: + buffer.append(coro.send(None)) + except StopIteration as ex: + result = ex.value if sys.version_info >= (3, 5) else ex.args[0] if ex.args else None + break + return buffer, result + + +async def test_async_temp_gh3337(x, y): + """ + >>> run_async(test_async_temp_gh3337(2, 3)) + ([], -1) + >>> run_async(test_async_temp_gh3337(3, 2)) + ([], 0) + """ + return min(x - y, 0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.14/tests/run/generators.pyx new/Cython-0.29.15/tests/run/generators.pyx --- old/Cython-0.29.14/tests/run/generators.pyx 2015-09-10 18:25:36.000000000 +0200 +++ new/Cython-0.29.15/tests/run/generators.pyx 2020-02-06 11:26:34.000000000 +0100 @@ -1,5 +1,5 @@ # mode: run -# tag: generators +# tag: generators, gh3265 try: import backports_abc @@ -502,3 +502,42 @@ True """ yield 1 + + +# GH Issue 3265 - **kwds could cause a crash in some cases due to not +# handling NULL pointers (in testing it shows as a REFNANNY error). +# This was on creation of the generator and +# doesn't really require it to be iterated through: + +def some_function(): + return 0 + + +def test_generator_kwds1(**kwargs): + """ + >>> for a in test_generator_kwds1(): + ... print(a) + 0 + """ + yield some_function(**kwargs) + + +def test_generator_kwds2(**kwargs): + """ + >>> for a in test_generator_kwds2(): + ... print(a) + 0 + """ + yield 0 + + +def test_generator_kwds3(**kwargs): + """ + This didn't actually crash before but is still worth a try + >>> len(list(test_generator_kwds3())) + 0 + >>> for a in test_generator_kwds3(a=1): + ... print(a) + a + """ + yield from kwargs.keys() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.14/tests/run/libcpp_algo.pyx new/Cython-0.29.15/tests/run/libcpp_algo.pyx --- old/Cython-0.29.14/tests/run/libcpp_algo.pyx 2015-06-22 14:53:11.000000000 +0200 +++ new/Cython-0.29.15/tests/run/libcpp_algo.pyx 2020-02-06 11:26:34.000000000 +0100 @@ -20,8 +20,8 @@ cdef vector[int] v = l if reverse: - make_heap(v.begin(), v.end(), greater) - sort_heap(v.begin(), v.end(), greater) + make_heap(v.begin(), v.end(), &greater) + sort_heap(v.begin(), v.end(), &greater) else: make_heap(v.begin(), v.end()) sort_heap(v.begin(), v.end()) @@ -38,7 +38,7 @@ """ cdef vector[int] v = l if reverse: - partial_sort(v.begin(), v.begin() + k, v.end(), greater) + partial_sort(v.begin(), v.begin() + k, v.end(), &greater) else: partial_sort(v.begin(), v.begin() + k, v.end()) return v @@ -53,7 +53,7 @@ """ cdef vector[int] v = l if reverse: - sort(v.begin(), v.end(), greater) + sort(v.begin(), v.end(), &greater) else: sort(v.begin(), v.end()) return v diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.14/tests/run/py3k_super.pyx new/Cython-0.29.15/tests/run/py3k_super.pyx --- old/Cython-0.29.14/tests/run/py3k_super.pyx 2015-06-22 14:53:11.000000000 +0200 +++ new/Cython-0.29.15/tests/run/py3k_super.pyx 2020-02-06 11:26:34.000000000 +0100 @@ -1,5 +1,5 @@ # mode: run -# tag: py3k_super +# tag: py3k_super, gh3246 class A(object): def method(self): @@ -89,3 +89,21 @@ # return super().method_cp() # cdef method_c(self): # return super().method_c() + + +def freeing_class_cell_temp_gh3246(): + # https://github.com/cython/cython/issues/3246 + """ + >>> abc = freeing_class_cell_temp_gh3246() + >>> abc().a + 1 + """ + class SimpleBase(object): + def __init__(self): + self.a = 1 + + class ABC(SimpleBase): + def __init__(self): + super().__init__() + + return ABC diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.14/tests/run/pyclass_dynamic_bases.pyx new/Cython-0.29.15/tests/run/pyclass_dynamic_bases.pyx --- old/Cython-0.29.14/tests/run/pyclass_dynamic_bases.pyx 2015-06-22 14:53:11.000000000 +0200 +++ new/Cython-0.29.15/tests/run/pyclass_dynamic_bases.pyx 2020-02-06 11:26:34.000000000 +0100 @@ -24,3 +24,22 @@ class PyClass(A if x else B): p = 5 return PyClass + + +def make_subclass(*bases): + """ + >>> cls = make_subclass(list) + >>> issubclass(cls, list) or cls.__mro__ + True + + >>> class Cls(object): pass + >>> cls = make_subclass(Cls, list) + >>> issubclass(cls, list) or cls.__mro__ + True + >>> issubclass(cls, Cls) or cls.__mro__ + True + """ + # GH-3338 + class MadeClass(*bases): + pass + return MadeClass diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.14/tests/run/test_coroutines_pep492.pyx new/Cython-0.29.15/tests/run/test_coroutines_pep492.pyx --- old/Cython-0.29.14/tests/run/test_coroutines_pep492.pyx 2018-11-24 10:20:06.000000000 +0100 +++ new/Cython-0.29.15/tests/run/test_coroutines_pep492.pyx 2020-02-06 11:26:34.000000000 +0100 @@ -2,6 +2,11 @@ # mode: run # tag: pep492, pep530, asyncfor, await +########### +# This file is a copy of the corresponding test file in CPython. +# Please keep in sync and do not add non-upstream tests. +########### + import re import gc import sys
