Repository navigation
Closed
Description
python/cpython#96510 de-coupled the Python and C level recursion limits which renamed some internal names. The following patch fixes the compilation errors with greenlet on the CPython main branch:
diff --git a/src/greenlet/greenlet_greenlet.hpp b/src/greenlet/greenlet_greenlet.hpp
index 1b8a83f..a036a08 100644
--- a/src/greenlet/greenlet_greenlet.hpp
+++ b/src/greenlet/greenlet_greenlet.hpp
@@ -826,7 +826,7 @@ void PythonState::operator<<(const PyThreadState *const tstate) G_NOEXCEPT
this->use_tracing = tstate->cframe->use_tracing;
#endif
#if GREENLET_PY311
- this->recursion_depth = tstate->recursion_limit - tstate->recursion_remaining;
+ this->recursion_depth = tstate->py_recursion_limit - tstate->py_recursion_remaining;
this->current_frame = tstate->cframe->current_frame;
this->datastack_chunk = tstate->datastack_chunk;
this->datastack_top = tstate->datastack_top;
@@ -862,7 +862,7 @@ void PythonState::operator>>(PyThreadState *const tstate) G_NOEXCEPT
tstate->cframe->use_tracing = this->use_tracing;
#endif
#if GREENLET_PY311
- tstate->recursion_remaining = tstate->recursion_limit - this->recursion_depth;
+ tstate->py_recursion_remaining = tstate->py_recursion_limit - this->recursion_depth;
tstate->cframe->current_frame = this->current_frame;
tstate->datastack_chunk = this->datastack_chunk;
tstate->datastack_top = this->datastack_top;
@@ -891,7 +891,7 @@ void PythonState::set_initial_state(const PyThreadState* const tstate) G_NOEXCEP
{
this->_top_frame = nullptr;
#if GREENLET_PY311
- this->recursion_depth = tstate->recursion_limit - tstate->recursion_remaining;
+ this->recursion_depth = tstate->py_recursion_limit - tstate->py_recursion_remaining;
#else
this->recursion_depth = tstate->recursion_depth;
#endifhowever does not do any of the version gating needed to work on a released version of CPython.
Reacted by Michael Droettboom, Andreas Motl, Hugo van Kemenade, raphaelauv and Edgar Ramírez Mondragón
Metadata
Metadata
Assignees
Labels
No labels
Activity
mdboom commentedon Nov 4, 2022
@tacaswell: I assume you don't mind if I take your patch and add the version guards to make it into a full pull request? (This is also breaking pyperformance atm).
Fix python-greenlet#323: Support Python 3.12
tacaswell commentedon Nov 6, 2022
@mdboom nope, not at all!
amotl commentedon Nov 15, 2022
Also seeing this at https://github.com/isarengineering/SecPi/actions/runs/3466304638/jobs/5789990791#step:9:442. Thank you already for submitting #327, @mdboom!
Fix python-greenlet#323: Support Python 3.12
Fix python-greenlet#323: Support Python 3.12
Merge pull request #327 from mdboom/python-312
py-greenlet: update to 3.0.1.
chore: add support for python 3.12
chore: add support for python 3.12
chore: add support for python 3.12
chore: add support for python 3.12
chore: add support for python 3.12
chore: add support for python 3.12
chore: add support for python 3.12