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

[RFE] Support Python 3.11 in the C extension #68

Open
gotmax23 opened this issue Nov 5, 2022 · 7 comments
Open

[RFE] Support Python 3.11 in the C extension #68

gotmax23 opened this issue Nov 5, 2022 · 7 comments
Labels
Effort: High tons of caffeine needed Priority: High A blocking bug or an important feature Type: Enhancement New feature or request

Comments

@gotmax23
Copy link

gotmax23 commented Nov 5, 2022

Welcome! You should write in your Bug Report:

Please add support for Python 3.11 to the C extension.

OS version: Fedora Rawhide

Python3 version (python3 -V -V):
3.11.0

Steps to reproduce:

  1. Attempt to build a wheel

Actual result (with the python stack trace if present):
the result you see

  cc1: fatal error: frozendict/src/3_11/frozendictobject.c: No such file or directory
  compilation terminated.
  error: command '/usr/bin/gcc' failed with exit code 1
  error: subprocess-exited-with-error
@gotmax23 gotmax23 added the Type: Bug Something isn't working label Nov 5, 2022
@lurch
Copy link
Contributor

lurch commented Nov 7, 2022

#67 (comment)

arkamar added a commit to arkamar/python-frozendict that referenced this issue Dec 3, 2022
This improves default behavior of setup.py in sense that py version of
frozendict is used for python versions which do not have C extension
available yet. This would probably reduce amount of issues similar to
[1-4] in future.

[1] Marco-Sulla#68
[2] Marco-Sulla#67
[3] Marco-Sulla#65
[4] Marco-Sulla#58
arkamar added a commit to arkamar/python-frozendict that referenced this issue Dec 3, 2022
This improves default behavior of setup.py in sense that py version of
frozendict is used for python versions which do not have C extension
available yet. This would probably reduce amount of issues similar to
[1-4] in future.

[1] Marco-Sulla#68
[2] Marco-Sulla#67
[3] Marco-Sulla#65
[4] Marco-Sulla#58
@mcepl
Copy link

mcepl commented Feb 21, 2023

Even copying 3_10 to 3_11 directory doesn’t help:

[   13s] running build_ext
[   13s] building 'frozendict._frozendict' extension
[   13s] creating build/temp.linux-x86_64-cpython-311
[   13s] creating build/temp.linux-x86_64-cpython-311/frozendict
[   13s] creating build/temp.linux-x86_64-cpython-311/frozendict/src
[   13s] creating build/temp.linux-x86_64-cpython-311/frozendict/src/3_11
[   13s] gcc -Wsign-compare -DNDEBUG -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -g -DOPENSSL_LOAD_CONF -fwrapv -fno-semantic-interposition -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -g -IVendor/ -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -g -IVendor/ -fPIC -I/home/abuild/rpmbuild/BUILD/frozendict-2.3.5/frozendict/src/3_11/Include -I/home/abuild/rpmbuild/BUILD/frozendict-2.3.5/frozendict/src/3_11/cpython_src/Objects -I/home/abuild/rpmbuild/BUILD/frozendict-2.3.5/frozendict/src/3_11/cpython_src/Objects/stringlib -I/home/abuild/rpmbuild/BUILD/frozendict-2.3.5/frozendict/src/3_11/cpython_src/Objects/clinic -I/home/abuild/rpmbuild/BUILD/frozendict-2.3.5/frozendict/src/3_11/cpython_src -I/usr/include/python3.11 -c frozendict/src/3_11/frozendictobject.c -o build/temp.linux-x86_64-cpython-311/frozendict/src/3_11/frozendictobject.o -DPY_SSIZE_T_CLEAN
[   13s] In file included from frozendict/src/3_11/frozendictobject.c:6:
[   13s] /home/abuild/rpmbuild/BUILD/frozendict-2.3.5/frozendict/src/3_11/cpython_src/Objects/dictobject.c: In function ‘_PyDict_CheckConsistency’:
[   13s] /home/abuild/rpmbuild/BUILD/frozendict-2.3.5/frozendict/src/3_11/cpython_src/Objects/dictobject.c:491:36: error: invalid use of undefined type ‘struct _dictvalues’
[   13s]   491 |                 CHECK(mp->ma_values[i] != NULL);
[   13s]       |                                    ^
[   13s] /home/abuild/rpmbuild/BUILD/frozendict-2.3.5/frozendict/src/3_11/cpython_src/Objects/dictobject.c:434:16: note: in definition of macro ‘CHECK’
[   13s]   434 |     do { if (!(expr)) { _PyObject_ASSERT_FAILED_MSG(op, Py_STRINGIFY(expr)); } } while (0)
[   13s]       |                ^~~~
[   13s] /home/abuild/rpmbuild/BUILD/frozendict-2.3.5/frozendict/src/3_11/cpython_src/Objects/dictobject.c:491:23: error: invalid use of incomplete typedef ‘PyDictValues’ {aka ‘struct _dictvalues’}
[   13s]   491 |                 CHECK(mp->ma_values[i] != NULL);
[   13s]       |                       ^~
[   13s] /home/abuild/rpmbuild/BUILD/frozendict-2.3.5/frozendict/src/3_11/cpython_src/Objects/dictobject.c:434:16: note: in definition of macro ‘CHECK’
[   13s]   434 |     do { if (!(expr)) { _PyObject_ASSERT_FAILED_MSG(op, Py_STRINGIFY(expr)); } } while (0)
[   13s]       |                ^~~~
[   13s] /home/abuild/rpmbuild/BUILD/frozendict-2.3.5/frozendict/src/3_11/cpython_src/Objects/dictobject.c: In function ‘_d_PyDict_Next’:
[   13s] /home/abuild/rpmbuild/BUILD/frozendict-2.3.5/frozendict/src/3_11/cpython_src/Objects/dictobject.c:799:30: error: invalid use of undefined type ‘struct _dictvalues’
[   13s]   799 |         value = mp->ma_values[i];
[   13s]       |                              ^
[   13s] /home/abuild/rpmbuild/BUILD/frozendict-2.3.5/frozendict/src/3_11/cpython_src/Objects/dictobject.c:799:17: error: invalid use of incomplete typedef ‘PyDictValues’ {aka ‘struct _dictvalues’}
[   13s]   799 |         value = mp->ma_values[i];
[   13s]       |                 ^~
[   13s] /home/abuild/rpmbuild/BUILD/frozendict-2.3.5/frozendict/src/3_11/cpython_src/Objects/dictobject.c: In function ‘dict_dealloc’:
[   13s] /home/abuild/rpmbuild/BUILD/frozendict-2.3.5/frozendict/src/3_11/cpython_src/Objects/dictobject.c:830:25: warning: initialization of ‘PyObject **’ {aka ‘struct _object **’} from incompatible pointer type ‘PyDictValues *’ {aka ‘struct _dictvalues *’} [-Wincompatible-pointer-types]
[   13s]   830 |     PyObject **values = mp->ma_values;
[   13s]       |                         ^~
[   13s] In file included from /usr/include/python3.11/Python.h:45,
[   13s]                  from frozendict/src/3_11/frozendictobject.c:1:
[   13s] /home/abuild/rpmbuild/BUILD/frozendict-2.3.5/frozendict/src/3_11/cpython_src/Objects/dictobject.c: In function ‘dict_traverse’:
[   13s] /home/abuild/rpmbuild/BUILD/frozendict-2.3.5/frozendict/src/3_11/cpython_src/Objects/dictobject.c:1090:39: error: invalid use of undefined type ‘struct _dictvalues’
[   13s]  1090 |                 Py_VISIT(mp->ma_values[i]);
[   13s]       |                                       ^
[   13s] /usr/include/python3.11/objimpl.h:199:13: note: in definition of macro ‘Py_VISIT’
[   13s]   199 |         if (op) {                                                       \
[   13s]       |             ^~
[   13s] /home/abuild/rpmbuild/BUILD/frozendict-2.3.5/frozendict/src/3_11/cpython_src/Objects/dictobject.c:1090:26: error: invalid use of incomplete typedef ‘PyDictValues’ {aka ‘struct _dictvalues’}
[   13s]  1090 |                 Py_VISIT(mp->ma_values[i]);
[   13s]       |                          ^~
[   13s] /usr/include/python3.11/objimpl.h:199:13: note: in definition of macro ‘Py_VISIT’
[   13s]   199 |         if (op) {                                                       \
[   13s]       |             ^~
[   13s] In file included from /usr/include/python3.11/Python.h:38:
[   13s] /home/abuild/rpmbuild/BUILD/frozendict-2.3.5/frozendict/src/3_11/cpython_src/Objects/dictobject.c:1090:39: error: invalid use of undefined type ‘struct _dictvalues’
[   13s]  1090 |                 Py_VISIT(mp->ma_values[i]);
[   13s]       |                                       ^
[   13s] /usr/include/python3.11/pyport.h:24:38: note: in definition of macro ‘_Py_CAST’
[   13s]    24 | #define _Py_CAST(type, expr) ((type)(expr))
[   13s]       |                                      ^~~~
[   13s] /usr/include/python3.11/objimpl.h:200:30: note: in expansion of macro ‘_PyObject_CAST’
[   13s]   200 |             int vret = visit(_PyObject_CAST(op), arg);                  \
[   13s]       |                              ^~~~~~~~~~~~~~
[   13s] /home/abuild/rpmbuild/BUILD/frozendict-2.3.5/frozendict/src/3_11/cpython_src/Objects/dictobject.c:1090:17: note: in expansion of macro ‘Py_VISIT’
[   13s]  1090 |                 Py_VISIT(mp->ma_values[i]);
[   13s]       |                 ^~~~~~~~
[   13s] /usr/include/python3.11/pyport.h:24:37: error: invalid use of incomplete typedef ‘PyDictValues’ {aka ‘struct _dictvalues’}
[   13s]    24 | #define _Py_CAST(type, expr) ((type)(expr))
[   13s]       |                                     ^
[   13s] /usr/include/python3.11/object.h:107:28: note: in expansion of macro ‘_Py_CAST’
[   13s]   107 | #define _PyObject_CAST(op) _Py_CAST(PyObject*, (op))
[   13s]       |                            ^~~~~~~~
[   13s] /usr/include/python3.11/objimpl.h:200:30: note: in expansion of macro ‘_PyObject_CAST’
[   13s]   200 |             int vret = visit(_PyObject_CAST(op), arg);                  \
[   13s]       |                              ^~~~~~~~~~~~~~
[   13s] /home/abuild/rpmbuild/BUILD/frozendict-2.3.5/frozendict/src/3_11/cpython_src/Objects/dictobject.c:1090:17: note: in expansion of macro ‘Py_VISIT’
[   13s]  1090 |                 Py_VISIT(mp->ma_values[i]);
[   13s]       |                 ^~~~~~~~
[   13s] frozendict/src/3_11/frozendictobject.c: In function ‘frozendict_merge’:
[   13s] frozendict/src/3_11/frozendictobject.c:453:41: error: invalid use of undefined type ‘struct _dictvalues’
[   13s]   453 |                 value = other->ma_values[i];
[   13s]       |                                         ^
[   13s] frozendict/src/3_11/frozendictobject.c:453:25: error: invalid use of incomplete typedef ‘PyDictValues’ {aka ‘struct _dictvalues’}
[   13s]   453 |                 value = other->ma_values[i];
[   13s]       |                         ^~~~~
[   13s] /home/abuild/rpmbuild/BUILD/frozendict-2.3.5/frozendict/src/3_11/cpython_src/Objects/dictobject.c: At top level:
[   13s] /home/abuild/rpmbuild/BUILD/frozendict-2.3.5/frozendict/src/3_11/cpython_src/Objects/dictobject.c:431:1: warning: ‘_PyDict_CheckConsistency’ defined but not used [-Wunused-function]
[   13s]   431 | _PyDict_CheckConsistency(PyObject *op, int check_content)
[   13s]       | ^~~~~~~~~~~~~~~~~~~~~~~~
[   13s] warning: build_ext: building extension "frozendict._frozendict" failed: command '/usr/bin/gcc' failed with exit code 1

BTW with all versions of Python I get this warning:

[   12s] In file included from frozendict/src/3_9/frozendictobject.c:6:
[   12s] /home/abuild/rpmbuild/BUILD/frozendict-2.3.5/frozendict/src/3_9/cpython_src/Objects/dictobject.c:443:1: warning: ‘_PyDict_CheckConsistency’ defined but not used [-Wunused-function]
[   12s]   443 | _PyDict_CheckConsistency(PyObject *op, int check_content)
[   12s]       | ^~~~~~~~~~~~~~~~~~~~~~~~

@Marco-Sulla Marco-Sulla added Priority: High A blocking bug or an important feature Effort: High tons of caffeine needed Type: Enhancement New feature or request and removed Type: Bug Something isn't working labels Feb 25, 2023
@Marco-Sulla
Copy link
Owner

@mcepl Well, dict in CPython 3.11 is changed a lot. I started to incorporate the new code into frozendict in the cpython_3_11 branch.

@PhorstenkampFuzzy
Copy link

For me a pipline just broke on because the newer version where not usable on 3.11. But the older versions build just fine for me on 3.11 using poetry and the python:3.11-slim image. Can it lead to problems?

@Marco-Sulla
Copy link
Owner

@PhorstenkampFuzzy

This is quite strange.

frozendict setup now builds a pure python wheel for archs and/or Python versions not (yet) supported by the C Extension.

Can you post:

  • the frozendict version
  • the pipeline
  • the error

?

@PhorstenkampFuzzy
Copy link

It does work fine for me and builds on the fly.
I am using:
python 3.11.0 on windows64 bit and the current python:3.11-slim docker image.
I am installing it as a poetry dependency and as a dependency when installing a wheel.
I am currently using 2.3.5 and 2.3.4. (Where there is a *.tar.gz published).

I have no problem at all so long as i do not increase the version to something where there is no *.tar.gz to build from.

@Marco-Sulla
Copy link
Owner

Marco-Sulla commented Apr 12, 2023

@PhorstenkampFuzzy Yes, this is fixed in 2.3.7. Sorry for the confusion.

matz-e added a commit to matz-e/spack that referenced this issue Jan 19, 2024
See also Marco-Sulla/python-frozendict#68, rely on a pure Python
implementation when 3.11+ is used.
matz-e added a commit to matz-e/spack that referenced this issue Jan 22, 2024
See also Marco-Sulla/python-frozendict#68, rely on a pure Python
implementation when 3.11+ is used.
adamjstewart pushed a commit to spack/spack that referenced this issue Jan 29, 2024
* py-frozendict: patch up for Python 3.11

See also Marco-Sulla/python-frozendict#68, rely on a pure Python
implementation when 3.11+ is used.

* mention related Github issue
RMeli pushed a commit to RMeli/spack that referenced this issue Jan 30, 2024
* py-frozendict: patch up for Python 3.11

See also Marco-Sulla/python-frozendict#68, rely on a pure Python
implementation when 3.11+ is used.

* mention related Github issue
kwryankrattiger pushed a commit to kwryankrattiger/spack that referenced this issue Jul 9, 2024
* py-frozendict: patch up for Python 3.11

See also Marco-Sulla/python-frozendict#68, rely on a pure Python
implementation when 3.11+ is used.

* mention related Github issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Effort: High tons of caffeine needed Priority: High A blocking bug or an important feature Type: Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants