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

cpython 3.12 incompatibility #30

Closed
Bastian-Krause opened this issue Aug 24, 2023 · 2 comments
Closed

cpython 3.12 incompatibility #30

Bastian-Krause opened this issue Aug 24, 2023 · 2 comments

Comments

@Bastian-Krause
Copy link

I know that this project is not actively maintained, but it's still being used by https://github.com/crossbario/autobahn-python.

pip install wsaccel==0.6.4 fails on Python 3.12.0-rc.1. The C code on https://pypi.org/project/wsaccel/ does not work with cpython3.12:

Building wheel for wsaccel (pyproject.toml): started
  Building wheel for wsaccel (pyproject.toml): finished with status 'error'
  error: subprocess-exited-with-error
  
  × Building wheel for wsaccel (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [169 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-312
      creating build/lib.linux-x86_64-cpython-312/wsaccel
      copying wsaccel/__init__.py -> build/lib.linux-x86_64-cpython-312/wsaccel
      running build_ext
      building 'wsaccel.utf8validator' extension
      creating build/temp.linux-x86_64-cpython-312
      creating build/temp.linux-x86_64-cpython-312/wsaccel
      gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -I/home/runner/work/labgrid/labgrid/crossbar-venv/include -I/opt/hostedtoolcache/Python/3.12.0-rc.1/x64/include/python3.12 -c wsaccel/utf8validator.c -o build/temp.linux-x86_64-cpython-312/wsaccel/utf8validator.o
      wsaccel/utf8validator.c: In function ‘__pyx_pf_7wsaccel_13utf8validator_13Utf8Validator_8__reduce_cython__’:
      wsaccel/utf8validator.c:3217:5: warning: ‘ma_version_tag’ is deprecated [-Wdeprecated-declarations]
       3217 |     __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pyx_unpickle_Utf8Validator); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error)
            |     ^~~~~~~~~~~~~~~~~~~~~~~~~
      In file included from /opt/hostedtoolcache/Python/3.12.0-rc.1/x64/include/python3.12/dictobject.h:90,
                       from /opt/hostedtoolcache/Python/3.12.0-rc.1/x64/include/python3.12/Python.h:61,
                       from wsaccel/utf8validator.c:6:
      /opt/hostedtoolcache/Python/3.12.0-rc.1/x64/include/python3.12/cpython/dictobject.h:22:34: note: declared here
         22 |     Py_DEPRECATED(3.12) uint64_t ma_version_tag;
            |                                  ^~~~~~~~~~~~~~
      wsaccel/utf8validator.c:3263:5: warning: ‘ma_version_tag’ is deprecated [-Wdeprecated-declarations]
       3263 |     __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_pyx_unpickle_Utf8Validator); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 15, __pyx_L1_error)
            |     ^~~~~~~~~~~~~~~~~~~~~~~~~
      In file included from /opt/hostedtoolcache/Python/3.12.0-rc.1/x64/include/python3.12/dictobject.h:90,
                       from /opt/hostedtoolcache/Python/3.12.0-rc.1/x64/include/python3.12/Python.h:61,
                       from wsaccel/utf8validator.c:6:
      /opt/hostedtoolcache/Python/3.12.0-rc.1/x64/include/python3.12/cpython/dictobject.h:22:34: note: declared here
         22 |     Py_DEPRECATED(3.12) uint64_t ma_version_tag;
            |                                  ^~~~~~~~~~~~~~
      wsaccel/utf8validator.c: In function ‘__pyx_pf___pyx_MemviewEnum___reduce_cython__’:
      wsaccel/utf8validator.c:5943:5: warning: ‘ma_version_tag’ is deprecated [-Wdeprecated-declarations]
       5943 |     __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
            |     ^~~~~~~~~~~~~~~~~~~~~~~~~
      In file included from /opt/hostedtoolcache/Python/3.12.0-rc.1/x64/include/python3.12/dictobject.h:90,
                       from /opt/hostedtoolcache/Python/3.12.0-rc.1/x64/include/python3.12/Python.h:61,
                       from wsaccel/utf8validator.c:6:
      /opt/hostedtoolcache/Python/3.12.0-rc.1/x64/include/python3.12/cpython/dictobject.h:22:34: note: declared here
         22 |     Py_DEPRECATED(3.12) uint64_t ma_version_tag;
            |                                  ^~~~~~~~~~~~~~
      wsaccel/utf8validator.c:5989:5: warning: ‘ma_version_tag’ is deprecated [-Wdeprecated-declarations]
       5989 |     __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
            |     ^~~~~~~~~~~~~~~~~~~~~~~~~
      In file included from /opt/hostedtoolcache/Python/3.12.0-rc.1/x64/include/python3.12/dictobject.h:90,
                       from /opt/hostedtoolcache/Python/3.12.0-rc.1/x64/include/python3.12/Python.h:61,
                       from wsaccel/utf8validator.c:6:
      /opt/hostedtoolcache/Python/3.12.0-rc.1/x64/include/python3.12/cpython/dictobject.h:22:34: note: declared here
         22 |     Py_DEPRECATED(3.12) uint64_t ma_version_tag;
            |                                  ^~~~~~~~~~~~~~
      wsaccel/utf8validator.c: In function ‘__pyx_memview_slice’:
      wsaccel/utf8validator.c:11126:3: warning: ‘Py_OptimizeFlag’ is deprecated [-Wdeprecated-declarations]
      11126 |   if (unlikely(!Py_OptimizeFlag)) {
            |   ^~
      In file included from /opt/hostedtoolcache/Python/3.12.0-rc.1/x64/include/python3.12/Python.h:48,
                       from wsaccel/utf8validator.c:6:
      /opt/hostedtoolcache/Python/3.12.0-rc.1/x64/include/python3.12/cpython/pydebug.h:13:37: note: declared here
         13 | Py_DEPRECATED(3.12) PyAPI_DATA(int) Py_OptimizeFlag;
            |                                     ^~~~~~~~~~~~~~~
      wsaccel/utf8validator.c: In function ‘__Pyx_PyInt_AndObjC’:
      wsaccel/utf8validator.c:19099:51: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’
      19099 |         const digit* digits = ((PyLongObject*)op1)->ob_digit;
            |                                                   ^~
      wsaccel/utf8validator.c: In function ‘__Pyx_get_tp_dict_version’:
      wsaccel/utf8validator.c:19403:5: warning: ‘ma_version_tag’ is deprecated [-Wdeprecated-declarations]
      19403 |     return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
            |     ^~~~~~
      In file included from /opt/hostedtoolcache/Python/3.12.0-rc.1/x64/include/python3.12/dictobject.h:90,
                       from /opt/hostedtoolcache/Python/3.12.0-rc.1/x64/include/python3.12/Python.h:61,
                       from wsaccel/utf8validator.c:6:
      /opt/hostedtoolcache/Python/3.12.0-rc.1/x64/include/python3.12/cpython/dictobject.h:22:34: note: declared here
         22 |     Py_DEPRECATED(3.12) uint64_t ma_version_tag;
            |                                  ^~~~~~~~~~~~~~
      wsaccel/utf8validator.c: In function ‘__Pyx_get_object_dict_version’:
      wsaccel/utf8validator.c:19415:5: warning: ‘ma_version_tag’ is deprecated [-Wdeprecated-declarations]
      19415 |     return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
            |     ^~~~~~
      In file included from /opt/hostedtoolcache/Python/3.12.0-rc.1/x64/include/python3.12/dictobject.h:90,
                       from /opt/hostedtoolcache/Python/3.12.0-rc.1/x64/include/python3.12/Python.h:61,
                       from wsaccel/utf8validator.c:6:
      /opt/hostedtoolcache/Python/3.12.0-rc.1/x64/include/python3.12/cpython/dictobject.h:22:34: note: declared here
         22 |     Py_DEPRECATED(3.12) uint64_t ma_version_tag;
            |                                  ^~~~~~~~~~~~~~
      wsaccel/utf8validator.c: In function ‘__Pyx_object_dict_version_matches’:
      wsaccel/utf8validator.c:19419:5: warning: ‘ma_version_tag’ is deprecated [-Wdeprecated-declarations]
      19419 |     if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
            |     ^~
      In file included from /opt/hostedtoolcache/Python/3.12.0-rc.1/x64/include/python3.12/dictobject.h:90,
                       from /opt/hostedtoolcache/Python/3.12.0-rc.1/x64/include/python3.12/Python.h:61,
                       from wsaccel/utf8validator.c:6:
      /opt/hostedtoolcache/Python/3.12.0-rc.1/x64/include/python3.12/cpython/dictobject.h:22:34: note: declared here
         22 |     Py_DEPRECATED(3.12) uint64_t ma_version_tag;
            |                                  ^~~~~~~~~~~~~~
      wsaccel/utf8validator.c: In function ‘__Pyx__GetModuleGlobalName’:
      wsaccel/utf8validator.c:19436:5: warning: ‘ma_version_tag’ is deprecated [-Wdeprecated-declarations]
      19436 |     __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
            |     ^~~~~~~~~~~~~~~~~~~~~~~
      In file included from /opt/hostedtoolcache/Python/3.12.0-rc.1/x64/include/python3.12/dictobject.h:90,
                       from /opt/hostedtoolcache/Python/3.12.0-rc.1/x64/include/python3.12/Python.h:61,
                       from wsaccel/utf8validator.c:6:
      /opt/hostedtoolcache/Python/3.12.0-rc.1/x64/include/python3.12/cpython/dictobject.h:22:34: note: declared here
         22 |     Py_DEPRECATED(3.12) uint64_t ma_version_tag;
            |                                  ^~~~~~~~~~~~~~
      wsaccel/utf8validator.c: In function ‘__Pyx_Raise’:
      wsaccel/utf8validator.c:19[829](https://github.com/Bastian-Krause/labgrid/actions/runs/5895185544/job/15991743057#step:9:830):34: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘curexc_traceback’
      19829 |         PyObject* tmp_tb = tstate->curexc_traceback;
            |                                  ^~
      wsaccel/utf8validator.c:19832:19: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘curexc_traceback’
      19832 |             tstate->curexc_traceback = tb;
            |                   ^~
      wsaccel/utf8validator.c: In function ‘__Pyx_PyUnicode_Equals’:
      wsaccel/utf8validator.c:557:51: warning: implicit declaration of function ‘_PyUnicode_Ready’; did you mean ‘PyUnicode_READY’? [-Wimplicit-function-declaration]
        557 |                                               0 : _PyUnicode_Ready((PyObject *)(op)))
            |                                                   ^~~~~~~~~~~~~~~~
      wsaccel/utf8validator.c:938:43: note: in definition of macro ‘unlikely’
        938 |   #define unlikely(x) __builtin_expect(!!(x), 0)
            |                                           ^
      wsaccel/utf8validator.c:20051:22: note: in expansion of macro ‘__Pyx_PyUnicode_READY’
      20051 |         if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
            |                      ^~~~~~~~~~~~~~~~~~~~~
      wsaccel/utf8validator.c: In function ‘__Pyx_PyInt_AddObjC’:
      wsaccel/utf8validator.c:20508:51: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’
      20508 |         const digit* digits = ((PyLongObject*)op1)->ob_digit;
            |                                                   ^~
      wsaccel/utf8validator.c: In function ‘__Pyx_CLineForTraceback’:
      wsaccel/utf8validator.c:20[830](https://github.com/Bastian-Krause/labgrid/actions/runs/5895185544/job/15991743057#step:9:831):9: warning: ‘ma_version_tag’ is deprecated [-Wdeprecated-declarations]
      20830 |         __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
            |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      In file included from /opt/hostedtoolcache/Python/3.12.0-rc.1/x64/include/python3.12/dictobject.h:90,
                       from /opt/hostedtoolcache/Python/3.12.0-rc.1/x64/include/python3.12/Python.h:61,
                       from wsaccel/utf8validator.c:6:
      /opt/hostedtoolcache/Python/3.12.0-rc.1/x64/include/python3.12/cpython/dictobject.h:22:34: note: declared here
         22 |     Py_DEPRECATED(3.12) uint64_t ma_version_tag;
            |                                  ^~~~~~~~~~~~~~
      wsaccel/utf8validator.c:20830:9: warning: ‘ma_version_tag’ is deprecated [-Wdeprecated-declarations]
      20830 |         __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
            |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      In file included from /opt/hostedtoolcache/Python/3.12.0-rc.1/x64/include/python3.12/dictobject.h:90,
                       from /opt/hostedtoolcache/Python/3.12.0-rc.1/x64/include/python3.12/Python.h:61,
                       from wsaccel/utf8validator.c:6:
      /opt/hostedtoolcache/Python/3.12.0-rc.1/x64/include/python3.12/cpython/dictobject.h:22:34: note: declared here
         22 |     Py_DEPRECATED(3.12) uint64_t ma_version_tag;
            |                                  ^~~~~~~~~~~~~~
      wsaccel/utf8validator.c: In function ‘__Pyx_PyInt_As_int’:
      wsaccel/utf8validator.c:22054:53: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’
      22054 |             const digit* digits = ((PyLongObject*)x)->ob_digit;
            |                                                     ^~
      wsaccel/utf8validator.c:22109:53: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’
      22109 |             const digit* digits = ((PyLongObject*)x)->ob_digit;
            |                                                     ^~
      wsaccel/utf8validator.c: In function ‘__Pyx_PyInt_As_long’:
      wsaccel/utf8validator.c:22250:53: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’
      22250 |             const digit* digits = ((PyLongObject*)x)->ob_digit;
            |                                                     ^~
      wsaccel/utf8validator.c:22305:53: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’
      22305 |             const digit* digits = ((PyLongObject*)x)->ob_digit;
            |                                                     ^~
      wsaccel/utf8validator.c: In function ‘__Pyx_PyInt_As_char’:
      wsaccel/utf8validator.c:22522:53: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’
      22522 |             const digit* digits = ((PyLongObject*)x)->ob_digit;
            |                                                     ^~
      wsaccel/utf8validator.c:22577:53: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’
      22577 |             const digit* digits = ((PyLongObject*)x)->ob_digit;
            |                                                     ^~
      wsaccel/utf8validator.c: In function ‘__Pyx_PyIndex_AsSsize_t’:
      wsaccel/utf8validator.c:22928:45: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’
      22928 |     const digit* digits = ((PyLongObject*)b)->ob_digit;
            |                                             ^~
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for wsaccel

Workaround:

pip install cython>=3.0.0
pip install "wsaccel @ git+https://github.com/methane/[email protected]"
Bastian-Krause added a commit to Bastian-Krause/crossbar that referenced this issue Aug 24, 2023
The imp module is deprecated since Python 3.4 [1]. The import was added
even after it was deprecated in [2]. In Python 3.12 the imp module will
be removed.

Use the reload function from importlib, which is the designated
replacement [1].

With crossbario#2091 and this change, crossbar can be installed and run on
Python 3.12 with:
- numpy>=1.26.0b1
- wsaccel @ git+https://github.com/methane/[email protected] (assuming
  cython>=3.0.0 is installed, tarball from pypi won't work [3])

[1] https://docs.python.org/3.11/library/imp.html
[2] crossbario@21910b0
[3] methane/wsaccel#30
oberstet pushed a commit to crossbario/crossbar that referenced this issue Aug 24, 2023
The imp module is deprecated since Python 3.4 [1]. The import was added
even after it was deprecated in [2]. In Python 3.12 the imp module will
be removed.

Use the reload function from importlib, which is the designated
replacement [1].

With #2091 and this change, crossbar can be installed and run on
Python 3.12 with:
- numpy>=1.26.0b1
- wsaccel @ git+https://github.com/methane/[email protected] (assuming
  cython>=3.0.0 is installed, tarball from pypi won't work [3])

[1] https://docs.python.org/3.11/library/imp.html
[2] 21910b0
[3] methane/wsaccel#30
@methane methane closed this as completed Sep 5, 2023
@methane
Copy link
Owner

methane commented Sep 5, 2023

released 0.6.6

@Bastian-Krause
Copy link
Author

Thanks!

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

No branches or pull requests

2 participants