Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] py312 compatibility #4788

Closed
tacaswell opened this issue May 13, 2022 · 2 comments
Closed

[BUG] py312 compatibility #4788

tacaswell opened this issue May 13, 2022 · 2 comments

Comments

@tacaswell
Copy link
Contributor

Describe the bug
A clear and concise description of what the bug is.

python/cpython#92537 removed the function _PyUnicode_Ready which cython is using.

To Reproduce
Code to reproduce the behaviour:

Attempt to build scipy fails with missing symbols. It looks like this changes was anticipated, however the code is guarded on defined(PyUnicode_IS_READY) and CPyhon retained that function as a no-op for back-compatibility. Checking if the private function is defined fixes this problem (but exposes another that I will open an issue for shortly).

I will open a PR shortly with the diff

$ git diff
diff --git a/Cython/Utility/ModuleSetupCode.c b/Cython/Utility/ModuleSetupCode.c
index f05840161..10b7b887d 100644
--- a/Cython/Utility/ModuleSetupCode.c
+++ b/Cython/Utility/ModuleSetupCode.c
@@ -928,7 +928,7 @@ static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict,
   /* new Py3.3 unicode type (PEP 393) */
   #define CYTHON_PEP393_ENABLED 1
 
-  #if defined(PyUnicode_IS_READY)
+  #if defined(_PyUnicode_Ready)
   #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ? \
                                               0 : _PyUnicode_Ready((PyObject *)(op)))
   #else
@@ -943,7 +943,7 @@ static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict,
   #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
   #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
   #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
-  #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
+  #if defined(_PyUnicode_Ready) && defined(PyUnicode_GET_SIZE)
   #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
   // Avoid calling deprecated C-API functions in Py3.9+ that PEP-623 schedules for removal in Py3.12.
   // https://www.python.org/dev/peps/pep-0623/

Expected behavior
A clear and concise description of what you expected to happen.

Environment (please complete the following information):

  • OS: [e.g. Linux, Windows, macOS] Linux
  • Python version [e.g. 3.8.4] current main (py312)
  • Cython version [e.g. 0.29.18] current master

Additional context
Add any other context about the problem here.

@da-woods
Copy link
Contributor

Closed by b4595a0 I think?

@tacaswell
Copy link
Contributor Author

I can confirm that this is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants