Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
contributed by Michał Górny. Note
that while greenlet will BUILD in a free-threaded Python, it will
cause the GIL to be allocated and used, and memory may leak.
- Fix an assertion error on debug builds of Python 3.14 when using the
experimental JIT. See :issue:`460
<https://github.com/python-greenlet/greenlet/issues/460>`_.


3.2.3 (2025-06-05)
Expand Down
6 changes: 6 additions & 0 deletions src/greenlet/TGreenlet.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ namespace greenlet
#endif
#if GREENLET_PY314
int py_recursion_depth;
// I think this is only used by the JIT. At least,
// we only got errors not switching it when the JIT was enabled.
// Python/generated_cases.c.h:12469: _PyEval_EvalFrameDefault:
// Assertion `tstate->current_executor == NULL' failed.
// see https://github.com/python-greenlet/greenlet/issues/460
PyObject* current_executor;
#elif GREENLET_PY312
int py_recursion_depth;
int c_recursion_depth;
Expand Down
4 changes: 4 additions & 0 deletions src/greenlet/TPythonState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ PythonState::PythonState()
#endif
#if GREENLET_PY314
,py_recursion_depth(0)
,current_executor(nullptr)
#elif GREENLET_PY312
,py_recursion_depth(0)
,c_recursion_depth(0)
Expand Down Expand Up @@ -136,6 +137,7 @@ void PythonState::operator<<(const PyThreadState *const tstate) noexcept
#if GREENLET_PY311
#if GREENLET_PY314
this->py_recursion_depth = tstate->py_recursion_limit - tstate->py_recursion_remaining;
this->current_executor = tstate->current_executor;
#elif GREENLET_PY312
this->py_recursion_depth = tstate->py_recursion_limit - tstate->py_recursion_remaining;
this->c_recursion_depth = Py_C_RECURSION_LIMIT - tstate->c_recursion_remaining;
Expand Down Expand Up @@ -213,6 +215,7 @@ void PythonState::operator>>(PyThreadState *const tstate) noexcept
#if GREENLET_PY311
#if GREENLET_PY314
tstate->py_recursion_remaining = tstate->py_recursion_limit - this->py_recursion_depth;
tstate->current_executor = this->current_executor;
this->unexpose_frames();
#elif GREENLET_PY312
tstate->py_recursion_remaining = tstate->py_recursion_limit - this->py_recursion_depth;
Expand Down Expand Up @@ -262,6 +265,7 @@ void PythonState::set_initial_state(const PyThreadState* const tstate) noexcept
this->_top_frame = nullptr;
#if GREENLET_PY314
this->py_recursion_depth = tstate->py_recursion_limit - tstate->py_recursion_remaining;
this->current_executor = tstate->current_executor;
#elif GREENLET_PY312
this->py_recursion_depth = tstate->py_recursion_limit - tstate->py_recursion_remaining;
// XXX: TODO: Comment from a reviewer:
Expand Down
Loading