Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-133079: Remove Py_C_RECURSION_LIMIT & PyThreadState.c_recursion_remaining#133080

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
encukou merged 1 commit intopython:mainfromencukou:remove-Py_C_RECURSION_LIMIT
Apr 29, 2025
Merged
Show file tree
Hide file tree
Changes fromall 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
7 changes: 7 additions & 0 deletionsDoc/whatsnew/3.14.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2256,3 +2256,10 @@ Removed
* Remove the private ``_Py_InitializeMain()`` function. It was a
:term:`provisional API` added to Python 3.8 by :pep:`587`.
(Contributed by Victor Stinner in :gh:`129033`.)

* The undocumented APIs :c:macro:`!Py_C_RECURSION_LIMIT` and
:c:member:`!PyThreadState.c_recursion_remaining`, added in 3.13, are removed
without a deprecation period.
Please use :c:func:`Py_EnterRecursiveCall` to guard against runaway recursion
in C code.
(Removed in :gh:`133079`, see also :gh:`130396`.)
4 changes: 0 additions & 4 deletionsInclude/cpython/pystate.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -120,8 +120,6 @@ struct _ts {

int py_recursion_remaining;
int py_recursion_limit;

int c_recursion_remaining; /* Retained for backwards compatibility. Do not use */
int recursion_headroom; /* Allow 50 more calls to handle any errors. */

/* 'tracing' keeps track of the execution depth when tracing/profiling.
Expand DownExpand Up@@ -212,8 +210,6 @@ struct _ts {
_PyRemoteDebuggerSupport remote_debugger_support;
};

# define Py_C_RECURSION_LIMIT 5000

/* other API */

/* Similar to PyThreadState_Get(), but don't issue a fatal error
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
The undocumented APIs :c:macro:`!Py_C_RECURSION_LIMIT` and
:c:member:`!PyThreadState.c_recursion_remaining`, added in 3.13, are removed
without a deprecation period.
1 change: 0 additions & 1 deletionPython/pystate.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1533,7 +1533,6 @@ init_threadstate(_PyThreadStateImpl *_tstate,

tstate->py_recursion_limit = interp->ceval.recursion_limit;
tstate->py_recursion_remaining = interp->ceval.recursion_limit;
tstate->c_recursion_remaining = 2;
tstate->exc_info = &tstate->exc_state;

// PyGILState_Release must not try to delete this thread state.
Expand Down
3 changes: 2 additions & 1 deletionPython/vm-state.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -73,7 +73,8 @@ It will be more complex in the JIT.

Another important piece of VM state is the **thread state**, held in `tstate`.
The current frame pointer, `frame`, is always equal to `tstate->current_frame`.
The thread state also holds the exception state (`tstate->exc_info`) and the recursion counters (`tstate->c_recursion_remaining` and `tstate->py_recursion_remaining`).
The thread state also holds the exception state (`tstate->exc_info`) and
recursion tracking data (`tstate->py_recursion_remaining`, `tstate->c_stack*`).

The thread state is also used to access the **interpreter state** (`tstate->interp`), which is important since the "eval breaker" flags are stored there (`tstate->interp->ceval.eval_breaker`, an "atomic" variable), as well as the "PEP 523 function" (`tstate->interp->eval_frame`).
The interpreter state also holds the optimizer state (`optimizer` and some counters).
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp