-
Notifications
You must be signed in to change notification settings - Fork 259
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.
mdboom, amotl, hugovk, raphaelauv and edgarrmondragon
Metadata
Metadata
Assignees
Labels
No labels