Hello community, here is the log from the commit of package python-Cython for openSUSE:Factory checked in at 2019-06-18 14:49:58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-Cython (Old) and /work/SRC/openSUSE:Factory/.python-Cython.new.4811 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-Cython" Tue Jun 18 14:49:58 2019 rev:49 rq:709360 version:0.29.10 Changes: -------- --- /work/SRC/openSUSE:Factory/python-Cython/python-Cython.changes 2019-04-18 09:55:36.805310671 +0200 +++ /work/SRC/openSUSE:Factory/.python-Cython.new.4811/python-Cython.changes 2019-06-18 14:50:00.429668698 +0200 @@ -1,0 +2,23 @@ +Wed Jun 12 09:42:55 UTC 2019 - Tomáš Chvátal <[email protected]> + +- Say goodbye to -doc subpackage as the documentation is online + and does not build with latest sphinx releases (even in master + at the moment). +- The testing in -doc spec was disabled anyway and if needed we + will reintroduce it as a multibuild + +------------------------------------------------------------------- +Mon Jun 3 13:37:55 UTC 2019 - Ondřej Súkup <[email protected]> + +- update to 0.29.10 + * Fix compile errors in CPython 3.8b1 due to the new "tp_vectorcall" slots. + * Remove an incorrect cast when using true-division in C++ operations. + * C compile errors with CPython 3.8 were resolved. + * Python tuple constants that compare equal but have different item types + could incorrectly be merged into a single constant. + * Non-ASCII characters in unprefixed strings could crash the compiler + when used with language level 3str + * Starred expressions in %-formatting tuples could fail to compile for unicode strings + * Passing Python class references through cython.inline() was broken. + +------------------------------------------------------------------- Old: ---- Cython-0.29.7.tar.gz python-Cython-doc.changes python-Cython-doc.spec New: ---- Cython-0.29.10.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-Cython.spec ++++++ --- /var/tmp/diff_new_pack.XamzgV/_old 2019-06-18 14:50:01.997668000 +0200 +++ /var/tmp/diff_new_pack.XamzgV/_new 2019-06-18 14:50:02.033667984 +0200 @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define oldpython python Name: python-Cython -Version: 0.29.7 +Version: 0.29.10 Release: 0 Summary: The Cython compiler for writing C extensions for the Python language License: Apache-2.0 ++++++ Cython-0.29.7.tar.gz -> Cython-0.29.10.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.7/.gitrev new/Cython-0.29.10/.gitrev --- old/Cython-0.29.7/.gitrev 2019-04-14 12:01:43.000000000 +0200 +++ new/Cython-0.29.10/.gitrev 2019-06-02 11:27:04.000000000 +0200 @@ -1 +1 @@ -3b3bcbfc3f28259e75e363b3d872e82b35d47f19 +34de6ba89d71a201019a0f4bc2bf24e6fa4e870f diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.7/CHANGES.rst new/Cython-0.29.10/CHANGES.rst --- old/Cython-0.29.7/CHANGES.rst 2019-04-14 12:00:58.000000000 +0200 +++ new/Cython-0.29.10/CHANGES.rst 2019-06-02 11:26:16.000000000 +0200 @@ -2,6 +2,51 @@ Cython Changelog ================ +0.29.10 (2019-06-02) +==================== + +Bugs fixed +---------- + +* Fix compile errors in CPython 3.8b1 due to the new "tp_vectorcall" slots. + (Github issue #2976) + + +0.29.9 (2019-05-29) +=================== + +Bugs fixed +---------- + +* Fix a crash regression in 0.29.8 when creating code objects fails. + +* Remove an incorrect cast when using true-division in C++ operations. + (Github issue #1950) + + +0.29.8 (2019-05-28) +=================== + +Bugs fixed +---------- + +* C compile errors with CPython 3.8 were resolved. + Patch by Marcel Plch. (Github issue #2938) + +* Python tuple constants that compare equal but have different item + types could incorrectly be merged into a single constant. + (Github issue #2919) + +* Non-ASCII characters in unprefixed strings could crash the compiler when + used with language level ``3str``. + +* Starred expressions in %-formatting tuples could fail to compile for + unicode strings. (Github issue #2939) + +* Passing Python class references through ``cython.inline()`` was broken. + (Github issue #2936) + + 0.29.7 (2019-04-14) =================== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.7/Cython/Build/Inline.py new/Cython-0.29.10/Cython/Build/Inline.py --- old/Cython-0.29.7/Cython/Build/Inline.py 2018-11-24 10:20:06.000000000 +0100 +++ new/Cython-0.29.10/Cython/Build/Inline.py 2019-05-27 21:37:21.000000000 +0200 @@ -90,7 +90,7 @@ elif 'numpy' in sys.modules and isinstance(arg, sys.modules['numpy'].ndarray): return 'numpy.ndarray[numpy.%s_t, ndim=%s]' % (arg.dtype.name, arg.ndim) else: - for base_type in py_type.mro(): + for base_type in py_type.__mro__: if base_type.__module__ in ('__builtin__', 'builtins'): return 'object' module = context.find_module(base_type.__module__, need_pxd=False) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.7/Cython/Build/Tests/TestInline.py new/Cython-0.29.10/Cython/Build/Tests/TestInline.py --- old/Cython-0.29.7/Cython/Build/Tests/TestInline.py 2018-11-24 10:20:06.000000000 +0100 +++ new/Cython-0.29.10/Cython/Build/Tests/TestInline.py 2019-05-27 21:37:21.000000000 +0200 @@ -51,6 +51,12 @@ foo = inline("def foo(x): return x * x", **self.test_kwds)['foo'] self.assertEquals(foo(7), 49) + def test_class_ref(self): + class Type(object): + pass + tp = inline("Type")['Type'] + self.assertEqual(tp, Type) + def test_pure(self): import cython as cy b = inline(""" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.7/Cython/Compiler/ExprNodes.py new/Cython-0.29.10/Cython/Compiler/ExprNodes.py --- old/Cython-0.29.7/Cython/Compiler/ExprNodes.py 2019-04-14 12:00:58.000000000 +0200 +++ new/Cython-0.29.10/Cython/Compiler/ExprNodes.py 2019-05-28 21:54:08.000000000 +0200 @@ -198,11 +198,13 @@ @return: A tuple that can be used as a dict key for deduplication. """ item_keys = [ - (py_object_type, None) if node is None + (py_object_type, None, type(None)) if node is None # For sequences and their "mult_factor", see TupleNode. else make_dedup_key(node.type, [node.mult_factor if node.is_literal else None] + node.args) if node.is_sequence_constructor else make_dedup_key(node.type, (node.start, node.stop, node.step)) if node.is_slice - else (node.type, node.constant_result) if node.has_constant_result() + # For constants, look at the Python value type if we don't know the concrete Cython type. + else (node.type, node.constant_result, + type(node.constant_result) if node.type is py_object_type else None) if node.has_constant_result() else None # something we cannot handle => short-circuit below for node in item_nodes ] @@ -1207,6 +1209,10 @@ return str(int(self.value)) def coerce_to(self, dst_type, env): + if dst_type == self.type: + return self + if dst_type is py_object_type and self.type is Builtin.bool_type: + return self if dst_type.is_pyobject and self.type.is_int: return BoolNode( self.pos, value=self.value, @@ -11526,7 +11532,7 @@ self.operand2 = self.operand2.coerce_to_simple(env) def compute_c_result_type(self, type1, type2): - if self.operator == '/' and self.ctruedivision: + if self.operator == '/' and self.ctruedivision and not type1.is_cpp_class and not type2.is_cpp_class: if not type1.is_float and not type2.is_float: widest_type = PyrexTypes.widest_numeric_type(type1, PyrexTypes.c_double_type) widest_type = PyrexTypes.widest_numeric_type(type2, widest_type) @@ -11617,7 +11623,7 @@ code.putln("}") def calculate_result_code(self): - if self.type.is_complex: + if self.type.is_complex or self.is_cpp_operation(): return NumBinopNode.calculate_result_code(self) elif self.type.is_float and self.operator == '//': return "floor(%s / %s)" % ( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.7/Cython/Compiler/Nodes.py new/Cython-0.29.10/Cython/Compiler/Nodes.py --- old/Cython-0.29.7/Cython/Compiler/Nodes.py 2019-04-14 12:00:58.000000000 +0200 +++ new/Cython-0.29.10/Cython/Compiler/Nodes.py 2019-06-02 11:26:16.000000000 +0200 @@ -4898,7 +4898,10 @@ code.error_goto(entry.pos))) # Don't inherit tp_print from builtin types, restoring the # behavior of using tp_repr or tp_str instead. + # ("tp_print" was renamed to "tp_vectorcall_offset" in Py3.8b1) + code.putln("#if PY_VERSION_HEX < 0x030800B1") code.putln("%s.tp_print = 0;" % typeobj_cname) + code.putln("#endif") # Use specialised attribute lookup for types with generic lookup but no instance dict. getattr_slot_func = TypeSlots.get_slot_code_by_name(scope, 'tp_getattro') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.7/Cython/Compiler/Optimize.py new/Cython-0.29.10/Cython/Compiler/Optimize.py --- old/Cython-0.29.7/Cython/Compiler/Optimize.py 2019-02-01 16:54:30.000000000 +0100 +++ new/Cython-0.29.10/Cython/Compiler/Optimize.py 2019-05-27 21:37:21.000000000 +0200 @@ -4322,6 +4322,9 @@ warning(pos, "Too few arguments for format placeholders", level=1) can_be_optimised = False break + if arg.is_starred: + can_be_optimised = False + break if format_type in u'asrfdoxX': format_spec = s[1:] if format_type in u'doxX' and u'.' in format_spec: @@ -4339,6 +4342,7 @@ else: # keep it simple for now ... can_be_optimised = False + break if not can_be_optimised: # Print all warnings we can find before finally giving up here. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.7/Cython/Compiler/Parsing.py new/Cython-0.29.10/Cython/Compiler/Parsing.py --- old/Cython-0.29.7/Cython/Compiler/Parsing.py 2018-11-24 10:20:06.000000000 +0100 +++ new/Cython-0.29.10/Cython/Compiler/Parsing.py 2019-05-27 21:37:21.000000000 +0200 @@ -958,7 +958,8 @@ error(pos, u"invalid character literal: %r" % bytes_value) else: bytes_value, unicode_value = chars.getstrings() - if is_python3_source and has_non_ascii_literal_characters: + if (has_non_ascii_literal_characters + and is_python3_source and Future.unicode_literals in s.context.future_directives): # Python 3 forbids literal non-ASCII characters in byte strings if kind == 'b': s.error("bytes can only contain ASCII literal characters.", pos=pos) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.7/Cython/Compiler/TypeSlots.py new/Cython-0.29.10/Cython/Compiler/TypeSlots.py --- old/Cython-0.29.7/Cython/Compiler/TypeSlots.py 2018-09-22 16:18:56.000000000 +0200 +++ new/Cython-0.29.10/Cython/Compiler/TypeSlots.py 2019-06-02 11:26:16.000000000 +0200 @@ -887,6 +887,7 @@ EmptySlot("tp_del"), EmptySlot("tp_version_tag"), EmptySlot("tp_finalize", ifdef="PY_VERSION_HEX >= 0x030400a1"), + EmptySlot("tp_vectorcall", ifdef="PY_VERSION_HEX >= 0x030800b1"), ) #------------------------------------------------------------------------------------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.7/Cython/Shadow.py new/Cython-0.29.10/Cython/Shadow.py --- old/Cython-0.29.7/Cython/Shadow.py 2019-04-14 12:00:58.000000000 +0200 +++ new/Cython-0.29.10/Cython/Shadow.py 2019-06-02 11:26:16.000000000 +0200 @@ -1,7 +1,7 @@ # cython.* namespace for pure mode. from __future__ import absolute_import -__version__ = "0.29.7" +__version__ = "0.29.10" try: from __builtin__ import basestring diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.7/Cython/Utility/AsyncGen.c new/Cython-0.29.10/Cython/Utility/AsyncGen.c --- old/Cython-0.29.7/Cython/Utility/AsyncGen.c 2018-11-24 10:20:06.000000000 +0100 +++ new/Cython-0.29.10/Cython/Utility/AsyncGen.c 2019-06-02 11:26:16.000000000 +0200 @@ -421,6 +421,9 @@ #elif PY_VERSION_HEX >= 0x030400a1 0, /* tp_finalize */ #endif +#if PY_VERSION_HEX >= 0x030800b1 + 0, /*tp_vectorcall*/ +#endif }; @@ -650,6 +653,9 @@ #if PY_VERSION_HEX >= 0x030400a1 0, /* tp_finalize */ #endif +#if PY_VERSION_HEX >= 0x030800b1 + 0, /*tp_vectorcall*/ +#endif }; @@ -759,6 +765,9 @@ #if PY_VERSION_HEX >= 0x030400a1 0, /* tp_finalize */ #endif +#if PY_VERSION_HEX >= 0x030800b1 + 0, /*tp_vectorcall*/ +#endif }; @@ -1038,6 +1047,9 @@ #if PY_VERSION_HEX >= 0x030400a1 0, /* tp_finalize */ #endif +#if PY_VERSION_HEX >= 0x030800b1 + 0, /*tp_vectorcall*/ +#endif }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.7/Cython/Utility/Coroutine.c new/Cython-0.29.10/Cython/Utility/Coroutine.c --- old/Cython-0.29.7/Cython/Utility/Coroutine.c 2018-11-24 10:20:06.000000000 +0100 +++ new/Cython-0.29.10/Cython/Utility/Coroutine.c 2019-06-02 11:26:16.000000000 +0200 @@ -1497,6 +1497,9 @@ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif +#if PY_VERSION_HEX >= 0x030800b1 + 0, /*tp_vectorcall*/ +#endif }; #if PY_VERSION_HEX < 0x030500B1 || defined(__Pyx_IterableCoroutine_USED) || CYTHON_USE_ASYNC_SLOTS @@ -1655,6 +1658,9 @@ #elif PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif +#if PY_VERSION_HEX >= 0x030800b1 + 0, /*tp_vectorcall*/ +#endif }; static int __pyx_Coroutine_init(void) { @@ -1760,6 +1766,9 @@ #if PY_VERSION_HEX >= 0x030400a1 __Pyx_Coroutine_del, /*tp_finalize*/ #endif +#if PY_VERSION_HEX >= 0x030800b1 + 0, /*tp_vectorcall*/ +#endif }; @@ -1860,6 +1869,9 @@ #elif PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif +#if PY_VERSION_HEX >= 0x030800b1 + 0, /*tp_vectorcall*/ +#endif }; static int __pyx_Generator_init(void) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.7/Cython/Utility/CythonFunction.c new/Cython-0.29.10/Cython/Utility/CythonFunction.c --- old/Cython-0.29.7/Cython/Utility/CythonFunction.c 2019-02-27 13:23:19.000000000 +0100 +++ new/Cython-0.29.10/Cython/Utility/CythonFunction.c 2019-06-02 11:26:16.000000000 +0200 @@ -730,6 +730,9 @@ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif +#if PY_VERSION_HEX >= 0x030800b1 + 0, /*tp_vectorcall*/ +#endif }; @@ -1203,6 +1206,9 @@ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif +#if PY_VERSION_HEX >= 0x030800b1 + 0, /*tp_vectorcall*/ +#endif }; static int __pyx_FusedFunction_init(void) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.7/Cython/Utility/ModuleSetupCode.c new/Cython-0.29.10/Cython/Utility/ModuleSetupCode.c --- old/Cython-0.29.7/Cython/Utility/ModuleSetupCode.c 2019-04-14 12:00:58.000000000 +0200 +++ new/Cython-0.29.10/Cython/Utility/ModuleSetupCode.c 2019-05-27 21:37:21.000000000 +0200 @@ -381,8 +381,13 @@ #define __Pyx_DefaultClassType PyClass_Type #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#if PY_VERSION_HEX < 0x030800A4 #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) +#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) +#endif #define __Pyx_DefaultClassType PyType_Type #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.7/Cython/Utility/Profile.c new/Cython-0.29.10/Cython/Utility/Profile.c --- old/Cython-0.29.7/Cython/Utility/Profile.c 2018-09-22 16:18:56.000000000 +0200 +++ new/Cython-0.29.10/Cython/Utility/Profile.c 2019-05-28 21:54:08.000000000 +0200 @@ -289,24 +289,25 @@ } static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno) { + PyCodeObject *py_code = 0; + +#if PY_MAJOR_VERSION >= 3 + py_code = PyCode_NewEmpty(srcfile, funcname, firstlineno); + // make CPython use a fresh dict for "f_locals" at need (see GH #1836) + if (likely(py_code)) { + py_code->co_flags |= CO_OPTIMIZED | CO_NEWLOCALS; + } +#else PyObject *py_srcfile = 0; PyObject *py_funcname = 0; - PyCodeObject *py_code = 0; - #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); + if (unlikely(!py_funcname)) goto bad; py_srcfile = PyString_FromString(srcfile); - #else - py_funcname = PyUnicode_FromString(funcname); - py_srcfile = PyUnicode_FromString(srcfile); - #endif - if (!py_funcname | !py_srcfile) goto bad; + if (unlikely(!py_srcfile)) goto bad; py_code = PyCode_New( 0, /*int argcount,*/ - #if PY_MAJOR_VERSION >= 3 - 0, /*int kwonlyargcount,*/ - #endif 0, /*int nlocals,*/ 0, /*int stacksize,*/ // make CPython use a fresh dict for "f_locals" at need (see GH #1836) @@ -326,6 +327,7 @@ bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); +#endif return py_code; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.7/PKG-INFO new/Cython-0.29.10/PKG-INFO --- old/Cython-0.29.7/PKG-INFO 2019-04-14 12:01:51.000000000 +0200 +++ new/Cython-0.29.10/PKG-INFO 2019-06-02 11:27:04.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: Cython -Version: 0.29.7 +Version: 0.29.10 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.7/runtests.py new/Cython-0.29.10/runtests.py --- old/Cython-0.29.7/runtests.py 2019-02-01 16:54:30.000000000 +0100 +++ new/Cython-0.29.10/runtests.py 2019-05-27 21:37:21.000000000 +0200 @@ -1416,11 +1416,11 @@ pass else: with self.stats.time(self.name, 'py', 'mypy'): - mypy_result = mypy_api.run(( + mypy_result = mypy_api.run([ self.module_path, '--ignore-missing-imports', '--follow-imports', 'skip', - )) + ]) if mypy_result[2]: self.fail(mypy_result[0]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.7/tests/run/cpp_operators.pyx new/Cython-0.29.10/tests/run/cpp_operators.pyx --- old/Cython-0.29.7/tests/run/cpp_operators.pyx 2018-11-24 10:20:06.000000000 +0100 +++ new/Cython-0.29.10/tests/run/cpp_operators.pyx 2019-05-28 21:54:08.000000000 +0200 @@ -1,6 +1,8 @@ # mode: run # tag: cpp, werror +from __future__ import division + from cython cimport typeof cimport cython.operator @@ -239,7 +241,7 @@ nonmember binary2 >> [const_char *] nonmember binary2 COMMA [const_char *] """ - + cdef TestOps* t = new TestOps() out(1 + t[0], typeof(1 + t[0])) out(1 - t[0], typeof(1 - t[0])) @@ -251,10 +253,10 @@ out(1 ^ t[0], typeof(1 ^ t[0])) out(1 << t[0], typeof(1 << t[0])) out(1 >> t[0], typeof(1 >> t[0])) - + x = cython.operator.comma(1, t[0]) out(x, typeof(x)) - + # now test float operators defined outside class out(1. + t[0], typeof(1. + t[0])) # operator - deliberately omitted @@ -266,7 +268,7 @@ out(1. ^ t[0], typeof(1. ^ t[0])) out(1. << t[0], typeof(1. << t[0])) out(1. >> t[0], typeof(1. >> t[0])) - + # for some reason we need a cdef here - not sure this is quite right y = cython.operator.comma(1., t[0]) out(y, typeof(y)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.7/tests/run/cython3.pyx new/Cython-0.29.10/tests/run/cython3.pyx --- old/Cython-0.29.7/tests/run/cython3.pyx 2019-04-14 12:00:58.000000000 +0200 +++ new/Cython-0.29.10/tests/run/cython3.pyx 2019-05-27 21:37:21.000000000 +0200 @@ -21,7 +21,8 @@ """ import sys -if sys.version_info[0] >= 3: +IS_PY2 = sys.version_info[0] < 3 +if not IS_PY2: __doc__ = __doc__.replace(" u'", " '") def locals_function(a, b=2): @@ -312,6 +313,45 @@ return ustring +def non_ascii_unprefixed_str(): + u""" + >>> s = non_ascii_unprefixed_str() + >>> isinstance(s, bytes) + False + >>> len(s) + 3 + """ + s = 'ø\x20\u0020' + assert isinstance(s, unicode) + return s + + +def non_ascii_raw_str(): + u""" + >>> s = non_ascii_raw_str() + >>> isinstance(s, bytes) + False + >>> len(s) + 11 + """ + s = r'ø\x20\u0020' + assert isinstance(s, unicode) + return s + + +def non_ascii_raw_prefixed_unicode(): + u""" + >>> s = non_ascii_raw_prefixed_unicode() + >>> isinstance(s, bytes) + False + >>> len(s) + 11 + """ + s = ru'ø\x20\u0020' + assert isinstance(s, unicode) + return s + + def str_type_is_unicode(): """ >>> str_type, s = str_type_is_unicode() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.7/tests/run/cython3_no_unicode_literals.pyx new/Cython-0.29.10/tests/run/cython3_no_unicode_literals.pyx --- old/Cython-0.29.7/tests/run/cython3_no_unicode_literals.pyx 2018-11-24 10:20:06.000000000 +0100 +++ new/Cython-0.29.10/tests/run/cython3_no_unicode_literals.pyx 2019-05-27 21:37:21.000000000 +0200 @@ -13,6 +13,10 @@ x = 'abc' """ +import sys +IS_PY2 = sys.version_info[0] < 3 + + def locals_function(a, b=2): x = 'abc' return locals() @@ -64,6 +68,65 @@ return str_string +def non_ascii_str(): + u""" + >>> s = 'ø\\x20\\u0020' + >>> isinstance(s, str) + True + >>> print(not IS_PY2 or len(s) == 9 or len(s)) # first is 2-char bytes in Py2, hex escape is resolved + True + >>> print(IS_PY2 or len(s) == 3 or len(s)) # 3 unicode characters in Py3 + True + + >>> s = non_ascii_str() + >>> isinstance(s, str) + True + >>> print(not IS_PY2 or len(s) == 9 or len(s)) # first is 2-char bytes in Py2, hex escape is resolved + True + >>> print(IS_PY2 or len(s) == 3 or len(s)) # 3 unicode characters in Py3 + True + """ + s = 'ø\x20\u0020' + assert isinstance(s, str) + assert (IS_PY2 and isinstance(s, bytes)) or (not IS_PY2 and isinstance(s, unicode)) + return s + + +def non_ascii_raw_str(): + u""" + >>> s = r'ø\\x20\\u0020' + >>> print(not IS_PY2 or len(s) == 12 or len(s)) # Py2 (first character is two bytes) + True + >>> print(IS_PY2 or len(s) == 11 or len(s)) # Py3 (unicode string) + True + + >>> s = non_ascii_raw_str() + >>> isinstance(s, str) + True + >>> print(not IS_PY2 or len(s) == 12 or len(s)) # Py2 (first character is two bytes) + True + >>> print(IS_PY2 or len(s) == 11 or len(s)) # Py3 (unicode string) + True + """ + s = r'ø\x20\u0020' + assert isinstance(s, str) + assert (IS_PY2 and isinstance(s, bytes)) or (not IS_PY2 and isinstance(s, unicode)) + return s + + +def non_ascii_raw_unicode(): + u""" + >>> s = non_ascii_raw_unicode() + >>> isinstance(s, bytes) + False + >>> len(s) + 11 + """ + s = ru'ø\x20\u0020' + assert isinstance(s, unicode) + return s + + def str_type_is_str(): """ >>> str_type, s = str_type_is_str() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.7/tests/run/pep448_extended_unpacking.pyx new/Cython-0.29.10/tests/run/pep448_extended_unpacking.pyx --- old/Cython-0.29.7/tests/run/pep448_extended_unpacking.pyx 2015-06-22 14:53:11.000000000 +0200 +++ new/Cython-0.29.10/tests/run/pep448_extended_unpacking.pyx 2019-05-27 21:37:21.000000000 +0200 @@ -1,3 +1,5 @@ +# mode: run +# tag: all_language_levels cimport cython @@ -144,6 +146,22 @@ return (*a, *b, 2, *c) +def unpack_tuple_in_string_formatting(a, *args): + """ + >>> print(unpack_tuple_in_string_formatting(1, 2)) + 1 2 + >>> print(unpack_tuple_in_string_formatting(1, 'x')) + 1 'x' + >>> unpack_tuple_in_string_formatting(1) # doctest: +ELLIPSIS + Traceback (most recent call last): + TypeError: ...format... + >>> unpack_tuple_in_string_formatting(1, 2, 3) # doctest: +ELLIPSIS + Traceback (most recent call last): + TypeError: ...format... + """ + return "%s %r" % (a, *args) + + #### lists diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.7/tests/run/test_unicode.pyx new/Cython-0.29.10/tests/run/test_unicode.pyx --- old/Cython-0.29.7/tests/run/test_unicode.pyx 2018-11-24 10:20:06.000000000 +0100 +++ new/Cython-0.29.10/tests/run/test_unicode.pyx 2019-06-02 11:26:16.000000000 +0200 @@ -842,7 +842,11 @@ self.assertEqual('h\u0130'.capitalize(), 'H\u0069\u0307') exp = '\u0399\u0308\u0300\u0069\u0307' self.assertEqual('\u1fd2\u0130'.capitalize(), exp) - self.assertEqual('finnish'.capitalize(), 'FInnish') + if sys.version_info < (3, 8): + self.assertEqual('finnish'.capitalize(), 'FInnish') + else: + self.assertEqual('finnish'.capitalize(), 'Finnish') + self.assertEqual('A\u0345\u03a3'.capitalize(), 'A\u0345\u03c2') def test_title(self): @@ -1666,6 +1670,11 @@ for c in set_o: self.assertEqual(c.encode('ascii').decode('utf7'), c) + if sys.version_info >= (3, 8): + with self.assertRaisesRegex(UnicodeDecodeError, + 'ill-formed sequence'): + b'+@'.decode('utf-7') + def test_codecs_utf8(self): self.assertEqual(''.encode('utf-8'), b'') self.assertEqual('\u20ac'.encode('utf-8'), b'\xe2\x82\xac') @@ -2136,12 +2145,8 @@ u = chr(c) for encoding in ('utf-7', 'utf-8', 'utf-16', 'utf-16-le', 'utf-16-be', 'raw_unicode_escape', - 'unicode_escape', 'unicode_internal'): - with warnings.catch_warnings(): - # unicode-internal has been deprecated - warnings.simplefilter("ignore", DeprecationWarning) - - self.assertEqual(str(u.encode(encoding),encoding), u) + 'unicode_escape'): + self.assertEqual(str(u.encode(encoding),encoding), u) # Roundtrip safety for BMP (just the first 256 chars) for c in range(256): @@ -2157,13 +2162,9 @@ # Roundtrip safety for non-BMP (just a few chars) with warnings.catch_warnings(): - # unicode-internal has been deprecated - warnings.simplefilter("ignore", DeprecationWarning) - u = '\U00010001\U00020002\U00030003\U00040004\U00050005' for encoding in ('utf-8', 'utf-16', 'utf-16-le', 'utf-16-be', - 'raw_unicode_escape', - 'unicode_escape', 'unicode_internal'): + 'raw_unicode_escape', 'unicode_escape'): self.assertEqual(str(u.encode(encoding),encoding), u) # UTF-8 must be roundtrip safe for all code points @@ -2382,22 +2383,23 @@ self.assertEqual(args[0], text) self.assertEqual(len(args), 1) + @unittest.skipIf(sys.version_info < (3, 8), 'resize test requires Py3.8+') + @support.cpython_only def test_resize(self): + from _testcapi import getargs_u for length in range(1, 100, 7): # generate a fresh string (refcount=1) text = 'a' * length + 'b' - with support.check_warnings(('unicode_internal codec has been ' - 'deprecated', DeprecationWarning)): - # fill wstr internal field - abc = text.encode('unicode_internal') - self.assertEqual(abc.decode('unicode_internal'), text) - - # resize text: wstr field must be cleared and then recomputed - text += 'c' - abcdef = text.encode('unicode_internal') - self.assertNotEqual(abc, abcdef) - self.assertEqual(abcdef.decode('unicode_internal'), text) + # fill wstr internal field + abc = getargs_u(text) + self.assertEqual(abc, text) + + # resize text: wstr field must be cleared and then recomputed + text += 'c' + abcdef = getargs_u(text) + self.assertNotEqual(abc, abcdef) + self.assertEqual(abcdef, text) def test_compare(self): # Issue #17615 @@ -2714,6 +2716,12 @@ check_format('%.%s', b'%.%s', b'abc') + # Issue #33817: empty strings + check_format('', + b'') + check_format('', + b'%s', b'') + # Test PyUnicode_AsWideChar() @support.cpython_only def test_aswidechar(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.7/tests/run/test_unicode_string_tests.pxi new/Cython-0.29.10/tests/run/test_unicode_string_tests.pxi --- old/Cython-0.29.7/tests/run/test_unicode_string_tests.pxi 2018-11-24 10:20:06.000000000 +0100 +++ new/Cython-0.29.10/tests/run/test_unicode_string_tests.pxi 2019-05-27 21:37:21.000000000 +0200 @@ -977,8 +977,9 @@ def test_capitalize_nonascii(self): # check that titlecased chars are lowered correctly # \u1ffc is the titlecased char - self.checkequal('\u03a9\u0399\u1ff3\u1ff3\u1ff3', - '\u1ff3\u1ff3\u1ffc\u1ffc', 'capitalize') + # Note: differs between Py<3.8 and later. + #self.checkequal('\u03a9\u0399\u1ff3\u1ff3\u1ff3', + # '\u1ff3\u1ff3\u1ffc\u1ffc', 'capitalize') # check with cased non-letter chars self.checkequal('\u24c5\u24e8\u24e3\u24d7\u24de\u24dd', '\u24c5\u24ce\u24c9\u24bd\u24c4\u24c3', 'capitalize') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Cython-0.29.7/tests/run/tuple_constants.pyx new/Cython-0.29.10/tests/run/tuple_constants.pyx --- old/Cython-0.29.7/tests/run/tuple_constants.pyx 2018-12-14 15:27:50.000000000 +0100 +++ new/Cython-0.29.10/tests/run/tuple_constants.pyx 2019-05-27 21:37:21.000000000 +0200 @@ -132,3 +132,38 @@ """ a = eval("1") return ('a', a, 'd') + + +def constant_types_comparing_equal(): + """ + >>> constant_types_comparing_equal() + ((False, False), (0, 0), (0.0, 0.0), (0, False), (False, 0.0), (0, 0.0)) + """ + bool_tuple= (False, False) + int_tuple = (0, 0) + float_tuple = (0.0, 0.0) + int_bool = (0, False) + bool_float = (False, 0.0) + int_float = (0, 0.0) + + assert bool_tuple is (False, False) + assert int_tuple is (0, 0) + assert bool_tuple == int_tuple + assert bool_tuple is not int_tuple + assert float_tuple is (0., 0.) + assert float_tuple == int_tuple + assert float_tuple is not int_tuple + assert int_bool is (0, False) + assert int_bool == bool_tuple + assert int_bool is not bool_tuple + assert int_bool is not int_tuple + assert bool_float is (False, 0.) + assert bool_float == bool_tuple + assert bool_float is not bool_tuple + assert bool_float is not float_tuple + assert int_float is (0, 0.) + assert int_float == int_tuple + assert int_float is not int_tuple + assert int_float is not float_tuple + + return bool_tuple, int_tuple, float_tuple, int_bool, bool_float, int_float
