diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2020-07-08 23:41:26 +0200 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2020-07-08 23:41:26 +0200 |
commit | ecac244d3b71ef073202e03391120afdb031013b (patch) | |
tree | 055bbc67e76023b5ea1e0b4bbf585d672cda90a9 | |
parent | 2e21c6946245f62fa182a81ee166920fc1185ebd (diff) | |
parent | 976f5483c6df8570f34076ef25af7e7512dd9347 (diff) | |
download | cython-ecac244d3b71ef073202e03391120afdb031013b.tar.gz |
Merge branch '0.29.x'
-rw-r--r-- | CHANGES.rst | 27 | ||||
-rw-r--r-- | Cython/Compiler/ExprNodes.py | 5 | ||||
-rw-r--r-- | tests/run/unicodeliterals.pyx | 10 |
3 files changed, 31 insertions, 11 deletions
diff --git a/CHANGES.rst b/CHANGES.rst index da8030354..c186c8970 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -456,7 +456,7 @@ Other changes * Support for Python 2.6 was removed. -0.29.21 (2020-0?-??) +0.29.21 (2020-07-09) ==================== Bugs fixed @@ -465,6 +465,12 @@ Bugs fixed * Fix a regression in 0.29.20 where ``__div__`` failed to be found in extension types. (Github issue #3688) +* Fix a regression in 0.29.20 where a call inside of a finally clause could fail to compile. + Patch by David Woods. (Github issue #3712) + +* Zero-sized buffers could fail to validate as C/Fortran-contiguous. + Patch by Clemens Hofreither. (Github issue #2093) + * ``exec()`` did not allow recent Python syntax features in Py3.8+ due to https://bugs.python.org/issue35975. (Github issue #3695) @@ -472,9 +478,22 @@ Bugs fixed * Binding staticmethods of Cython functions were not behaving like Python methods in Py3. Patch by Jeroen Demeyer and Michał Górny. (Github issue #3106) -* The deprecated C-API functions ``PyUnicode_FromUnicode()`` and ``PyUnicode_AS_UNICODE()`` - are no longer used. - Original patch by Inada Naoki. (Github issue #3677) +* Pythran calls to NumPy methods no longer generate useless method lookup code. + +* The ``PyUnicode_GET_LENGTH()`` macro was missing from the ``cpython.*`` declarations. + Patch by Thomas Caswell. (Github issue #3692) + +* The deprecated ``PyUnicode_*()`` C-API functions are no longer used, except for Unicode + strings that contain lone surrogates. Unicode strings that contain non-BMP characters + or surrogate pairs now generate different C code on 16-bit Python 2.x Unicode deployments + (such as MS-Windows). Generating the C code on Python 3.x is recommended in this case. + Original patches by Inada Naoki and Victor Stinner. (Github issues #3677, #3721, #3697) + +* Some template parameters were missing from the C++ ``std::unordered_map`` declaration. + Patch by will. (Github issue #3685) + +* Several internal code generation issues regarding temporary variables were resolved. + (Github issue #3708) 0.29.20 (2020-06-10) diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index ae61d742d..fcb69130d 100644 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -1686,13 +1686,14 @@ class UnicodeNode(ConstNode): # lone (unpaired) surrogates are not really portable and cannot be # decoded by the UTF-8 codec in Py3.3 self.result_code = code.get_py_const(py_object_type, 'ustring') - data_cname = code.get_pyunicode_ptr_const(self.value) + data_cname = code.get_string_const( + StringEncoding.BytesLiteral(self.value.encode('unicode_escape'))) const_code = code.get_cached_constants_writer(self.result_code) if const_code is None: return # already initialised const_code.mark_pos(self.pos) const_code.putln( - "%s = PyUnicode_FromUnicode(%s, (sizeof(%s) / sizeof(Py_UNICODE))-1); %s" % ( + "%s = PyUnicode_DecodeUnicodeEscape(%s, sizeof(%s) - 1, NULL); %s" % ( self.result_code, data_cname, data_cname, diff --git a/tests/run/unicodeliterals.pyx b/tests/run/unicodeliterals.pyx index 1947c6009..1449f5534 100644 --- a/tests/run/unicodeliterals.pyx +++ b/tests/run/unicodeliterals.pyx @@ -86,15 +86,15 @@ __doc__ = br""" True >>> h == u'\\ud800' # unescaped by Python (required by doctest) True - >>> p == u'\\ud800\\udc00' # unescaped by Python (required by doctest) + >>> p == (u'\\ud800\\udc00' if sys.maxunicode == 1114111 else u'\\U00010000') or p # unescaped by Python (required by doctest) True - >>> q == u'\\udc00\\ud800' # unescaped by Python (required by doctest) + >>> q == u'\\udc00\\ud800' or q # unescaped by Python (required by doctest) True - >>> k == u'\\N{SNOWMAN}' == u'\\u2603' + >>> k == u'\\N{SNOWMAN}' == u'\\u2603' or k True - >>> m == u'abc\\\\xf8\\\\t\\u00f8\\U000000f8' # unescaped by Python (required by doctest) + >>> m == u'abc\\\\xf8\\\\t\\u00f8\\U000000f8' or m # unescaped by Python (required by doctest) True - >>> add == u'Søk ik' + u'üÖä' + 'abc' + >>> add == u'Søk ik' + u'üÖä' + 'abc' or add True >>> null == u'\\x00' # unescaped by Python (required by doctest) True |