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

Adapt to exc_info changes in Py3.11 #4500

Closed
scoder opened this issue Dec 17, 2021 · 25 comments · Fixed by #4584
Closed

Adapt to exc_info changes in Py3.11 #4500

scoder opened this issue Dec 17, 2021 · 25 comments · Fixed by #4584

Comments

@scoder
Copy link
Contributor

scoder commented Dec 17, 2021

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

@TeamSpen210
Copy link
Contributor

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.

@scoder
Copy link
Contributor Author

scoder commented Dec 17, 2021

Yes, that's the idea.

@tacaswell
Copy link
Contributor

The failures from this look like: (from installing cython itself)

    gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/home/tcaswell/.virtualenvs/bleeding/include -I/home/tcaswell/.pybuild/bleeding/include/python3.11 -c /home/tcaswell/source/other_source/cython/Cython/Compiler/Scanning.c -o build/temp.linux-x86_64-3.11/home/tcaswell/source/other_source/cython/Cython/Compiler/Scanning.o
    /home/tcaswell/source/other_source/cython/Cython/Compiler/Scanning.c: In function ‘__Pyx_PyErr_GetTopmostException’:
    /home/tcaswell/source/other_source/cython/Cython/Compiler/Scanning.c:23059:21: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_type’
    23059 |     while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
          |                     ^~
    /home/tcaswell/source/other_source/cython/Cython/Compiler/Scanning.c:23059:51: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_type’
    23059 |     while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
          |                                                   ^~
    /home/tcaswell/source/other_source/cython/Cython/Compiler/Scanning.c: In function ‘__Pyx__ExceptionSave’:
    /home/tcaswell/source/other_source/cython/Cython/Compiler/Scanning.c:23073:21: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_type’
    23073 |     *type = exc_info->exc_type;
          |                     ^~
    /home/tcaswell/source/other_source/cython/Cython/Compiler/Scanning.c:23075:19: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_traceback’
    23075 |     *tb = exc_info->exc_traceback;
          |                   ^~
    /home/tcaswell/source/other_source/cython/Cython/Compiler/Scanning.c: In function ‘__Pyx__ExceptionReset’:
    /home/tcaswell/source/other_source/cython/Cython/Compiler/Scanning.c:23089:24: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_type’
    23089 |     tmp_type = exc_info->exc_type;
          |                        ^~
    /home/tcaswell/source/other_source/cython/Cython/Compiler/Scanning.c:23091:22: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_traceback’
    23091 |     tmp_tb = exc_info->exc_traceback;
          |                      ^~
    /home/tcaswell/source/other_source/cython/Cython/Compiler/Scanning.c:23092:13: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_type’
    23092 |     exc_info->exc_type = type;
          |             ^~
    /home/tcaswell/source/other_source/cython/Cython/Compiler/Scanning.c:23094:13: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_traceback’
    23094 |     exc_info->exc_traceback = tb;
          |             ^~
    /home/tcaswell/source/other_source/cython/Cython/Compiler/Scanning.c: In function ‘__Pyx__GetException’:
    /home/tcaswell/source/other_source/cython/Cython/Compiler/Scanning.c:23151:28: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_type’
    23151 |         tmp_type = exc_info->exc_type;
          |                            ^~
    /home/tcaswell/source/other_source/cython/Cython/Compiler/Scanning.c:23153:26: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_traceback’
    23153 |         tmp_tb = exc_info->exc_traceback;
          |                          ^~
    /home/tcaswell/source/other_source/cython/Cython/Compiler/Scanning.c:23154:17: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_type’
    23154 |         exc_info->exc_type = local_type;
          |                 ^~
    /home/tcaswell/source/other_source/cython/Cython/Compiler/Scanning.c:23156:17: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_traceback’
    23156 |         exc_info->exc_traceback = local_tb;
          |                 ^~
    error: command '/lib/ccache/bin/gcc' failed with exit code 1


@YoSTEALTH
Copy link
Contributor

YoSTEALTH commented Jan 18, 2022

Another victim to this bug: https://bugs.python.org/issue46428

Edit: was using Cython 3.0.0a10 btw

@da-woods
Copy link
Contributor

With reference to the comment in the duplicate issue

I would rather have this fixed in the master branch first and wait with a release in 0.29.x until there is at least a beta release of CPython 3.11. I'd like to avoid churn in the legacy 0.29.x branch.

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

@hroncok
Copy link
Contributor

hroncok commented Jan 19, 2022

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.

@scoder
Copy link
Contributor Author

scoder commented Jan 19, 2022

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.

scoder added a commit that referenced this issue Jan 23, 2022
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
@scoder
Copy link
Contributor Author

scoder commented Jan 23, 2022

I wonder if it's enough for 0.29.x to disable CYTHON_FAST_THREAD_STATE in Py3.11 – in case that switch works correctly there. It would disable more than necessary, but should avoid the direct access to exc_info. As usual, users who want speed and features can switch to Cython 3.

Turns out, no, _PyErr_StackItem is also used in Cython's coroutines and isn't protected by the feature flag there (obviously).

scoder added a commit to scoder/cython that referenced this issue Jan 23, 2022
@CaselIT
Copy link

CaselIT commented Jan 23, 2022

As usual, users who want speed and features can switch to Cython 3.

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

@mattip
Copy link
Contributor

mattip commented Jan 24, 2022

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?

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.

@scoder
Copy link
Contributor Author

scoder commented Jan 24, 2022

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?

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.

One problem with depending on cython v3 is that it cannot be used on conda-forge

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.)

@da-woods
Copy link
Contributor

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.

Although of course for Python 3.11 this isn't true, because changes to Python will probably break current Cython versions...

@scoder
Copy link
Contributor Author

scoder commented Jan 24, 2022

But as always with Cython, if a specific version works for you, it won't randomly stop working later.

... 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.

@scoder
Copy link
Contributor Author

scoder commented Jan 24, 2022

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.

@mattip
Copy link
Contributor

mattip commented Jan 24, 2022

One problem with depending on cython v3 is that it cannot be used on conda-forge

Is there a reason why conda-forge cannot add it?

Probably not, there is conda-forge/cython-feedstock#75 to try to get it going

@hrnciar
Copy link
Contributor

hrnciar commented Jan 24, 2022

I've tried to backport #4584 (see [0]) on top of 0.29.26 and managed to build Cython with it. But I ran into a segfault during the build of lxml 4.7.1 [1]. I've tried to debug it using gdb, but I cannot tell what's causing the failure. Maybe my backport is incorrect or there is some other problem in Cython. See [2] for full gdb output. Could you please take a look and help me to find out what's causing the failure?

[0] 0001-Backport-4584.txt
[1] https://download.copr.fedorainfracloud.org/results/@python/python3.11/fedora-rawhide-x86_64/03247525-python-lxml/builder-live.log.gz
[2] gdb-output.txt

@CaselIT
Copy link

CaselIT commented Jan 24, 2022

@mattip @scoder thanks for the explanation. I guess we will wait for the next v3 alpha that includes the py3.11 change and give it a try. Thanks!

@zzzeek
Copy link

zzzeek commented Jan 24, 2022

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?

@scoder
Copy link
Contributor Author

scoder commented Jan 24, 2022

I've tried to backport #4584 (see [0]) on top of 0.29.26 and managed to build Cython with it. But I ran into a segfault during the build of lxml 4.7.1 [1]. I've tried to debug it using gdb, but I cannot tell what's causing the failure. Maybe my backport is incorrect or there is some other problem in Cython. See [2] for full gdb output. Could you please take a look and help me to find out what's causing the failure?

#3  0x00007ffff704e795 in __Pyx_Coroutine_ResetFrameBackpointer (exc_state=0x7ffff6a8b6d0) at src/lxml/etree.c:265100
#4  __Pyx_Coroutine_SendEx (self=0x7ffff6a8b6b0, value=<optimized out>, closing=<optimized out>)

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.

@vstinner
Copy link
Contributor

vstinner commented Feb 1, 2022

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".
https://mail.python.org/archives/list/python-dev@python.org/thread/RS2C53LDZPXHRR2VCY2G2YSPDVA4LNQU/

dvarrazzo added a commit to psycopg/psycopg that referenced this issue May 15, 2022
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.
@dvarrazzo
Copy link
Contributor

dvarrazzo commented Jul 12, 2022

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 🙂

psycopg/psycopg#305

Thank you for your work!

dvarrazzo added a commit to psycopg/psycopg that referenced this issue Sep 8, 2022
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.
pcmoritz pushed a commit to ray-project/ray that referenced this issue Jan 7, 2023
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.
AmeerHajAli pushed a commit to ray-project/ray that referenced this issue Jan 12, 2023
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.
tamohannes pushed a commit to ju2ez/ray that referenced this issue Jan 16, 2023
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>
tamohannes pushed a commit to ju2ez/ray that referenced this issue Jan 25, 2023
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>
tamohannes pushed a commit to ju2ez/ray that referenced this issue Jan 25, 2023
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>
james-advmach added a commit to james-advmach/pyheatshrink that referenced this issue Jan 31, 2023
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.
XuanWang-Amos added a commit to grpc/grpc that referenced this issue Jun 1, 2023
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.
gnossen pushed a commit to gnossen/grpc that referenced this issue Jun 1, 2023
)

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.
XuanWang-Amos added a commit to XuanWang-Amos/grpc that referenced this issue Jun 2, 2023
)

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.
XuanWang-Amos added a commit to grpc/grpc that referenced this issue Jun 2, 2023
… 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.
eugeneo pushed a commit to eugeneo/grpc that referenced this issue Jun 7, 2023
)

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.
eugeneo pushed a commit to eugeneo/grpc that referenced this issue Jun 7, 2023
)

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.
mario-vimal pushed a commit to mario-vimal/grpc that referenced this issue Jun 15, 2023
)

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.
@riemanli
Copy link

@vstinner if you build Cython 0.29.x with CFLAGS="-DCYTHON_FAST_THREAD_STATE=0 -DCYTHON_USE_EXC_INFO_STACK=0" python3.11 setup.py build_ext --inplace -f it successfully builds itself. I think there's some coroutine code that still needs fixing, but I think it's likely a significant chunk of Cython libraries will also work with those flags (it looks sufficient to build Numpy, for example).

I'd propose getting those settings into 0.29.x by default now (because it'll fix the majority of incompatibilities I think). Obviously that isn't fully compatible so it isn't "job done" but it's an easy start

Is this still the solution to this issue when using 0.29.x?

@scoder
Copy link
Contributor Author

scoder commented Nov 15, 2023

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.

@scoder
Copy link
Contributor Author

scoder commented Nov 15, 2023

Actually, no, this is fixed also in 0.29.28 and later. Still, it's worth using Cython 3.x instead.

See #4610

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.