-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
A call to PyUnicode_AsUnicode exposes the PyUnicodeObject.wstr field. This is removed in 3.12. The documentation says it is deprecated since 3.3, and it was removed in python/cpython#92537. This will require a workaround for this code
cython/Cython/Utility/TypeConversion.c
Line 101 in 849d147
| #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode |
which is used here
cython/Cython/Compiler/PyrexTypes.py
Line 2563 in 0e1d4bc
| self.from_py_function = "__Pyx_PyUnicode_AsUnicode" |
I ran up against this in the py_unicode_strings tests when it uses a unicode object in a call to a cdef function with this signature cdef assert_Py_UNICODE_equal(const Py_UNICODE* u1, const Py_UNICODE* u2)
cython/tests/run/py_unicode_strings.pyx
Line 98 in e9ffbb8
| assert_Py_UNICODE_equal(uwide_literal, <Py_UNICODE*>c_pu_wide_literal) |
The code might be hard to replace 1:1 since there is no longer a safe way to access the underlying PyUnicodeObject internal buffer, the remaining interfaces all need to deal with freeing the buffer when done with it.