-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Adapt to exc_info changes in Py3.11 #4500
Comments
There's some additional discussion here that indicates that (aside from two undocumented edge cases) the type and tb will always match the value, so Cython could actually just always discard the redundant pointers. |
Yes, that's the idea. |
The failures from this look like: (from installing cython itself)
|
Another victim to this bug: https://bugs.python.org/issue46428 Edit: was using |
With reference to the comment in the duplicate issue
I suspect this may generate complaints - I think a good chunk of the performance tests needed for "have we made Python faster" depend on Cython 0.29.x, so there will be people chasing a compatible release |
The same concern applies to Fedora. We want to test our packages with Python 3.11 pre-releases, but can hardly do that without working Cython. We can backport patches from a draft pull request or whatnot, but backporting them directly from the master branch is usually quite tricky. |
Let's get something clean into the master branch first. And then see what needs to be done to apply the same to 0.29.x, and what the impact is. |
Adapt to "exc_info" changes in CPython 3.11a4, where "->exc_type" and "->exc_traceback" are gone and now get inferred from "->exc_value". Closes #4500
Turns out, no, |
…oved "exc_info->exc_type". See cython#4500
Is v3 currently ok for production use, or since it's in alpha it's still in the "expect bugs"/"use at your own peril" phase? Maybe question is more like is it already used by popular libraries? The context is that for sqlalchemy v2 we have replaced c extension with cython versions, and we wanted to start testing for py311 (since fedora is already reporting bugs for that version). Thanks! cc @zzzeek |
One problem with depending on cython v3 is that it cannot be used on conda-forge, so if you depend on it for a release, it will make building your package there more complicated: either you will have to package generated c files or add a "install from source" step to the recipe to get v3 into the environment. |
Cython 3.0 is still in alpha because it is a) not feature complete yet and b) we reserve the right to fix bugs also in backwards incompatible ways before the final release, if that seems necessary, despite of our usual goal to keep things working for our users. But as always with Cython, if a specific version works for you, it won't randomly stop working later. You can try it out yourself.
Is there a reason why conda-forge cannot add it? (Including the generated C files in your source distribution is always an option, and tends to be easy to do, although we are now moving away from recommending it in order to make it easier for packagers to move to a newer Cython version that supports newer CPython releases etc.) |
Although of course for Python 3.11 this isn't true, because changes to Python will probably break current Cython versions... |
... for the Python versions that it supports and was tested with. It's not like that has ever been different, with any version of Cython or Python. Both are live projects that change over time. |
In the master branch, the exception handling seems to work in Py 3.11 now, with #4584 merged. There is still an issue with line tracing, which might be related to exception handling or not. And a couple of C compiler warnings that are worth looking into. Regarding the backport 0.29.x, I tried to put the new implementations in #4584 next to the old ones to make the code clearer and easier to maintain, but it is quite a large change overall. I'd be happy to find something simpler (such as disabling feature flags), but would at least let this mature a bit before we consider backporting the whole change to 0.29.x. |
Probably not, there is conda-forge/cython-feedstock#75 to try to get it going |
I've tried to backport #4584 (see [0]) on top of [0] 0001-Backport-4584.txt |
just because I know zero about anything "conda" , does this limitation mean that if SQLAlchemy depended on cython3, that SQLAlchemy could not be included in the anaconda distribution ? something like that? |
I'm sure there were changes in this area in the master branch. I remember doing some cleanups and fixing several issues with coroutines for recent CPython features such as limited API support, extension type specs and what not. Can't say how much of that went into 0.29.x. Probably not everything, given that 0.29.x is pretty much in bug-fix-only mode and has been for a while. I'm not saying that that's necessarily the issue here, but I'm not surprised that the change is not stand-alone. |
Cython 0.29.x is currently incompatible with the development version of Python 3.11, but this issue has been closed. Should a new issue be opened about Cython 0.29.x, or can this issue be reopened? The Python change on exceptions breaks Cython which breaks numpy. I proposed to revert the change in Python until Cython is ready for the change: https://bugs.python.org/issue45711#msg412264 I also opened a discussion on python-dev: "Please update Cython before introcuding C API incompatible changes in Python". |
Probably this will not fix the build. We need a version fixing: - cython/cython#4500 - cython/cython#4721 which have been merged to master but apparently not released yet.
Hello! I wonder if you have a timeline to release Cython 3.0.0a11 including this fix (and #4721). As far as I could see, they are the only blockers to release psycopg 3 for Python 3.11 🙂 Thank you for your work! |
Probably this will not fix the build. We need a version fixing: - cython/cython#4500 - cython/cython#4721 which have been merged to master but apparently not released yet.
Preliminary PR for adding Python 3.11 support, mapping out various dependencies, fixing issues. ### Main changes - Upgrade cython to 0.29.32 - Add CI/CD steps for 3.11 wheel - Change cython code to not use `recursion_depth` - Update cloudpickle to latest - Use newer manylinux2014 which has python3.11 - Condition certain python packages in requirements.txt on <3.11 that don't yet have a 3.11 version ### Checklist: - cython - [x] remove deprecated `recursion_depth` - [x] exc_type cython/cython#4500 - [ ] package dependencies https://pyreadiness.org/3.11/ - [ ] llvmlite numba/llvmlite#869 - [ ] numba numba/numba#8304 - [ ] pyarrow - [ ] scikit-learn - [ ] pydantic - [x] cloudpickle - [x] upgrade cython to 0.29.32 - [ ] tensorflow tensorflow/tensorflow#58032 - [ ] torch pytorch/pytorch#86566 - [ ] miniconda conda/conda#11170 - [ ] `docker/base-deps/Dockerfile` - [x] claim to support 3.11 in setup.py - [ ] cicd - [ ] .buildkite/ - [ ] .buildkite/pipeline.build.yml - [ ] ci/ - [ ] ci/build/test-wheels.sh - [ ] ci/build/build-docker-images.py - [ ] release tests - [ ] docker/retag-lambda/python_versions.txt - [ ] download_wheels.sh - [ ] wheels - [ ] `python/build-wheel-macos.sh` - [ ] `python/build-wheel-windows.sh` - [ ] Tests - [ ] pytest ray/serve/tests - [ ] python python/ray/serve/examples/echo_full.py - [ ] bazel test //:core_worker_test - [ ] bazel test --build_tests_only //:all - [ ] //python/ray/tests:test_pydantic_serialization fastapi/fastapi#5048 - [ ] //python/ray/train:test_torch_utils - [ ] Documentation - [x] installation.rst Current status: Linux and mac wheels build in CICD. Docker images will come in a separate PR.
Preliminary PR for adding Python 3.11 support, mapping out various dependencies, fixing issues. ### Main changes - Upgrade cython to 0.29.32 - Add CI/CD steps for 3.11 wheel - Change cython code to not use `recursion_depth` - Update cloudpickle to latest - Use newer manylinux2014 which has python3.11 - Condition certain python packages in requirements.txt on <3.11 that don't yet have a 3.11 version ### Checklist: - cython - [x] remove deprecated `recursion_depth` - [x] exc_type cython/cython#4500 - [ ] package dependencies https://pyreadiness.org/3.11/ - [ ] llvmlite numba/llvmlite#869 - [ ] numba numba/numba#8304 - [ ] pyarrow - [ ] scikit-learn - [ ] pydantic - [x] cloudpickle - [x] upgrade cython to 0.29.32 - [ ] tensorflow tensorflow/tensorflow#58032 - [ ] torch pytorch/pytorch#86566 - [ ] miniconda conda/conda#11170 - [ ] `docker/base-deps/Dockerfile` - [x] claim to support 3.11 in setup.py - [ ] cicd - [ ] .buildkite/ - [ ] .buildkite/pipeline.build.yml - [ ] ci/ - [ ] ci/build/test-wheels.sh - [ ] ci/build/build-docker-images.py - [ ] release tests - [ ] docker/retag-lambda/python_versions.txt - [ ] download_wheels.sh - [ ] wheels - [ ] `python/build-wheel-macos.sh` - [ ] `python/build-wheel-windows.sh` - [ ] Tests - [ ] pytest ray/serve/tests - [ ] python python/ray/serve/examples/echo_full.py - [ ] bazel test //:core_worker_test - [ ] bazel test --build_tests_only //:all - [ ] //python/ray/tests:test_pydantic_serialization fastapi/fastapi#5048 - [ ] //python/ray/train:test_torch_utils - [ ] Documentation - [x] installation.rst Current status: Linux and mac wheels build in CICD. Docker images will come in a separate PR.
Preliminary PR for adding Python 3.11 support, mapping out various dependencies, fixing issues. ### Main changes - Upgrade cython to 0.29.32 - Add CI/CD steps for 3.11 wheel - Change cython code to not use `recursion_depth` - Update cloudpickle to latest - Use newer manylinux2014 which has python3.11 - Condition certain python packages in requirements.txt on <3.11 that don't yet have a 3.11 version ### Checklist: - cython - [x] remove deprecated `recursion_depth` - [x] exc_type cython/cython#4500 - [ ] package dependencies https://pyreadiness.org/3.11/ - [ ] llvmlite numba/llvmlite#869 - [ ] numba numba/numba#8304 - [ ] pyarrow - [ ] scikit-learn - [ ] pydantic - [x] cloudpickle - [x] upgrade cython to 0.29.32 - [ ] tensorflow tensorflow/tensorflow#58032 - [ ] torch pytorch/pytorch#86566 - [ ] miniconda conda/conda#11170 - [ ] `docker/base-deps/Dockerfile` - [x] claim to support 3.11 in setup.py - [ ] cicd - [ ] .buildkite/ - [ ] .buildkite/pipeline.build.yml - [ ] ci/ - [ ] ci/build/test-wheels.sh - [ ] ci/build/build-docker-images.py - [ ] release tests - [ ] docker/retag-lambda/python_versions.txt - [ ] download_wheels.sh - [ ] wheels - [ ] `python/build-wheel-macos.sh` - [ ] `python/build-wheel-windows.sh` - [ ] Tests - [ ] pytest ray/serve/tests - [ ] python python/ray/serve/examples/echo_full.py - [ ] bazel test //:core_worker_test - [ ] bazel test --build_tests_only //:all - [ ] //python/ray/tests:test_pydantic_serialization fastapi/fastapi#5048 - [ ] //python/ray/train:test_torch_utils - [ ] Documentation - [x] installation.rst Current status: Linux and mac wheels build in CICD. Docker images will come in a separate PR. Signed-off-by: tmynn <hovhannes.tamoyan@gmail.com>
Preliminary PR for adding Python 3.11 support, mapping out various dependencies, fixing issues. ### Main changes - Upgrade cython to 0.29.32 - Add CI/CD steps for 3.11 wheel - Change cython code to not use `recursion_depth` - Update cloudpickle to latest - Use newer manylinux2014 which has python3.11 - Condition certain python packages in requirements.txt on <3.11 that don't yet have a 3.11 version ### Checklist: - cython - [x] remove deprecated `recursion_depth` - [x] exc_type cython/cython#4500 - [ ] package dependencies https://pyreadiness.org/3.11/ - [ ] llvmlite numba/llvmlite#869 - [ ] numba numba/numba#8304 - [ ] pyarrow - [ ] scikit-learn - [ ] pydantic - [x] cloudpickle - [x] upgrade cython to 0.29.32 - [ ] tensorflow tensorflow/tensorflow#58032 - [ ] torch pytorch/pytorch#86566 - [ ] miniconda conda/conda#11170 - [ ] `docker/base-deps/Dockerfile` - [x] claim to support 3.11 in setup.py - [ ] cicd - [ ] .buildkite/ - [ ] .buildkite/pipeline.build.yml - [ ] ci/ - [ ] ci/build/test-wheels.sh - [ ] ci/build/build-docker-images.py - [ ] release tests - [ ] docker/retag-lambda/python_versions.txt - [ ] download_wheels.sh - [ ] wheels - [ ] `python/build-wheel-macos.sh` - [ ] `python/build-wheel-windows.sh` - [ ] Tests - [ ] pytest ray/serve/tests - [ ] python python/ray/serve/examples/echo_full.py - [ ] bazel test //:core_worker_test - [ ] bazel test --build_tests_only //:all - [ ] //python/ray/tests:test_pydantic_serialization fastapi/fastapi#5048 - [ ] //python/ray/train:test_torch_utils - [ ] Documentation - [x] installation.rst Current status: Linux and mac wheels build in CICD. Docker images will come in a separate PR. Signed-off-by: tmynn <hovhannes.tamoyan@gmail.com>
Attempting to install this package with python 3.11 currently fails when pip attempts to build the wheel from the sdist. This appears to be due to changes introduced in CPython 3.11a4 which removed exc_type and exc_traceback fields in the _PyErr_StackItem structure. See: cython/cython#4500 This patch bumps the cython requirement to the latest version, and regenerates the cython C files.
We just found out that our current Bazel setup does not support Python 3.11. Thus PR updates some dependencies to allow using Bazel in Python 3.11. Cython: * Cython [backported Python 3.11 support change to 0.29x](cython/cython#4500), but it appears that the Cython version we are using in Bazel does not include the fix, so we're using the latest stable version instead. Gevent: * The first version of gevent that supports [Python 3.11 is 22.08.0](gevent/gevent#1903 (comment)). #### Testing * Tested locally using Python 3.11 virtual environment, was able to reproduce the issue and verified that those changes were able to fix it.
) We just found out that our current Bazel setup does not support Python 3.11. Thus PR updates some dependencies to allow using Bazel in Python 3.11. Cython: * Cython [backported Python 3.11 support change to 0.29x](cython/cython#4500), but it appears that the Cython version we are using in Bazel does not include the fix, so we're using the latest stable version instead. Gevent: * The first version of gevent that supports [Python 3.11 is 22.08.0](gevent/gevent#1903 (comment)). #### Testing * Tested locally using Python 3.11 virtual environment, was able to reproduce the issue and verified that those changes were able to fix it.
) We just found out that our current Bazel setup does not support Python 3.11. Thus PR updates some dependencies to allow using Bazel in Python 3.11. Cython: * Cython [backported Python 3.11 support change to 0.29x](cython/cython#4500), but it appears that the Cython version we are using in Bazel does not include the fix, so we're using the latest stable version instead. Gevent: * The first version of gevent that supports [Python 3.11 is 22.08.0](gevent/gevent#1903 (comment)). #### Testing * Tested locally using Python 3.11 virtual environment, was able to reproduce the issue and verified that those changes were able to fix it.
… backport) (#33329) Backport of #33318 to v1.56.x. --- We just found out that our current Bazel setup does not support Python 3.11. This PR updates some dependencies to allow using Bazel in Python 3.11. Cython: * Cython [backported Python 3.11 support change to 0.29x](cython/cython#4500), but it appears that the Cython version we are using in Bazel does not include the fix, so we're using the latest stable version instead. Gevent: * The first version of gevent that supports [Python 3.11 is 22.08.0](gevent/gevent#1903 (comment)). #### Testing * Tested locally using Python 3.11 virtual environment, was able to reproduce the issue and verified that those changes were able to fix it.
) We just found out that our current Bazel setup does not support Python 3.11. Thus PR updates some dependencies to allow using Bazel in Python 3.11. Cython: * Cython [backported Python 3.11 support change to 0.29x](cython/cython#4500), but it appears that the Cython version we are using in Bazel does not include the fix, so we're using the latest stable version instead. Gevent: * The first version of gevent that supports [Python 3.11 is 22.08.0](gevent/gevent#1903 (comment)). #### Testing * Tested locally using Python 3.11 virtual environment, was able to reproduce the issue and verified that those changes were able to fix it.
) We just found out that our current Bazel setup does not support Python 3.11. Thus PR updates some dependencies to allow using Bazel in Python 3.11. Cython: * Cython [backported Python 3.11 support change to 0.29x](cython/cython#4500), but it appears that the Cython version we are using in Bazel does not include the fix, so we're using the latest stable version instead. Gevent: * The first version of gevent that supports [Python 3.11 is 22.08.0](gevent/gevent#1903 (comment)). #### Testing * Tested locally using Python 3.11 virtual environment, was able to reproduce the issue and verified that those changes were able to fix it.
) We just found out that our current Bazel setup does not support Python 3.11. Thus PR updates some dependencies to allow using Bazel in Python 3.11. Cython: * Cython [backported Python 3.11 support change to 0.29x](cython/cython#4500), but it appears that the Cython version we are using in Bazel does not include the fix, so we're using the latest stable version instead. Gevent: * The first version of gevent that supports [Python 3.11 is 22.08.0](gevent/gevent#1903 (comment)). #### Testing * Tested locally using Python 3.11 virtual environment, was able to reproduce the issue and verified that those changes were able to fix it.
Is this still the solution to this issue when using 0.29.x? |
When using 0.29.x and not 3.0.x, then yes, looks like that's needed. I'll see if I can get a 0.29.x point release out that does this automatically. |
Actually, no, this is fixed also in 0.29.28 and later. Still, it's worth using Cython 3.x instead. See #4610 |
Py3.11 alpha has been changed to keep only a single exception value internally in
sys.exc_info
instead of a(type, value, traceback)
tuple. There are a couple of places in Cython where we touch those fields and we should a) adapt and b) make sure we don't unnecessarily swap dead fields in Py3.11.If this stays in CPython until the release, it's probably worth also backporting the necessary changes to 0.29.x.
First reported in #4499 (comment)
https://bugs.python.org/issue45711
The text was updated successfully, but these errors were encountered: