10000 Merge branch 'main' into mypy-tomllib · python/cpython@f08fad9 · GitHub
[go: up one dir, main page]

Skip to content

Commit f08fad9

Browse files
authored
Merge branch 'main' into mypy-tomllib
2 parents 318ffa7 + 59ff421 commit f08fad9

File tree

6 files changed

+12
-8
lines changed

6 files changed

+12
-8
lines changed

Doc/deprecations/pending-removal-in-future.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ although there is currently no date scheduled for their removal.
1313
deprecated.
1414
* The :class:`argparse.FileType` type converter is deprecated.
1515

16-
* :mod:`array`'s ``'u'`` format code (:gh:`57281`)
17-
1816
* :mod:`builtins`:
1917

2018
* ``bool(NotImplemented)``.

Doc/whatsnew/3.14.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2280,3 +2280,10 @@ Removed
22802280
* Remove the private ``_Py_InitializeMain()`` function. It was a
22812281
:term:`provisional API` added to Python 3.8 by :pep:`587`.
22822282
(Contributed by Victor Stinner in :gh:`129033`.)
2283+
2284+
* The undocumented APIs :c:macro:`!Py_C_RECURSION_LIMIT` and
2285+
:c:member:`!PyThreadState.c_recursion_remaining`, added in 3.13, are removed
2286+
without a deprecation period.
2287+
Please use :c:func:`Py_EnterRecursiveCall` to guard against runaway recursion
2288+
in C code.
2289+
(Removed in :gh:`133079`, see also :gh:`130396`.)

Include/cpython/pystate.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,6 @@ struct _ts {
118118

119119
int py_recursion_remaining;
120120
int py_recursion_limit;
121-
122-
int c_recursion_remaining; /* Retained for backwards compatibility. Do not use */
123121
int recursion_headroom; /* Allow 50 more calls to handle any errors. */
124122

125123
/* 'tracing' keeps track of the execution depth when tracing/profiling.
@@ -210,8 +208,6 @@ struct _ts {
210208
_PyRemoteDebuggerSupport remote_debugger_support;
211209
};
212210

213-
# define Py_C_RECURSION_LIMIT 5000
214-
215211
/* other API */
216212

217213
/* Similar to PyThreadState_Get(), but don't issue a fatal error
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
The undocumented APIs :c:macro:`!Py_C_RECURSION_LIMIT` and
2+
:c:member:`!PyThreadState.c_recursion_remaining`, added in 3.13, are removed
3+
without a deprecation period.

Python/pystate.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1559,7 +1559,6 @@ init_threadstate(_PyThreadStateImpl *_tstate,
15591559

15601560
tstate->py_recursion_limit = interp->ceval.recursion_limit;
15611561
tstate->py_recursion_remaining = interp->ceval.recursion_limit;
1562-
tstate->c_recursion_remaining = 2;
15631562
tstate->exc_info = &tstate->exc_state;
15641563

15651564
// PyGILState_Release must not try to delete this thread state.

Python/vm-state.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ It will be more complex in the JIT.
7373

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

7879
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`).
7980
The interpreter state also holds the optimizer state (`optimizer` and some counters).

0 commit comments

Comments
 (0)
0