[issue41834] Remove _Py_CheckRecursionLimit variable

2020-10-01 Thread STINNER Victor


Change by STINNER Victor :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41834] Remove _Py_CheckRecursionLimit variable

2020-09-23 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 19c3ac92bf73f1902cff846988552fd7bb8a8621 by Victor Stinner in 
branch 'master':
bpo-41834: Remove _Py_CheckRecursionLimit variable (GH-22359)
https://github.com/python/cpython/commit/19c3ac92bf73f1902cff846988552fd7bb8a8621


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41834] Remove _Py_CheckRecursionLimit variable

2020-09-22 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch
pull_requests: +21397
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22359

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41834] Remove _Py_CheckRecursionLimit variable

2020-09-22 Thread STINNER Victor


New submission from STINNER Victor :

_Py_CheckRecursionLimit variable is no longer needed and can be removed.

In Python 3.9, I added a recursion limit per interpreter.

In Python 3.8 and older, it was used by _Py_MakeRecCheck() macro to check for 
recursion error. 

Previously, the _Py_CheckRecursionLimit variable was kept for backward 
compatibility with the stable ABI, but in Python 3.8 and older, 
Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() could not be used with the 
limited C API since these macros accessed PyThreadState structure member, 
whereas the structure is opaque in the limited C API.

Attached PR removed the variable.

---

(3) bpo-40513: Limit made per interpreter.

commit 4e30ed3af06ae655f4cb8aad8cba21f341384250
Author: Victor Stinner 
Date:   Tue May 5 16:52:52 2020 +0200

bpo-40513: Per-interpreter recursion_limit (GH-19929)

Move recursion_limit member from _PyRuntimeState.ceval to
PyInterpreterState.ceval.

* Py_SetRecursionLimit() now only sets _Py_CheckRecursionLimit
  of ceval.c if the current Python thread is part of the main
  interpreter.
* Inline _Py_MakeEndRecCheck() into _Py_LeaveRecursiveCall().
* Convert _Py_RecursionLimitLowerWaterMark() macro into a static
  inline function.

---

(2) bpo-38644: The _Py_CheckRecursionLimit variable was used by 
Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() macros. I converted these 
macros into function calls in Python 3.9:

commit f4b1e3d7c64985f5d5b00f6cc9a1c146bbbfd613
Author: Victor Stinner 
Date:   Mon Nov 4 19:48:34 2019 +0100

bpo-38644: Add Py_EnterRecursiveCall() to the limited API (GH-17046)

Provide Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() as
regular functions for the limited API. Previously, there were defined
as macros, but these macros didn't work with the limited API which
cannot access PyThreadState.recursion_depth field.

Remove _Py_CheckRecursionLimit from the stable ABI.

Add Include/cpython/ceval.h header file.

In pycore_ceval.h, the function is overriden by a macro which points to an 
inline function which uses:

* tstate->recursion_depth
* tstate->interp->ceval.recursion_limit
* tstate->stackcheck_counter (if USE_STACKCHECK macro is defined)

---

(1) bpo-31857: Original change adding the FIXME.

commit 1896793520a49a6f97ae360c0b288967e56b005e
Author: pdox 
Date:   Wed Oct 25 23:03:01 2017 -0700

bpo-31857: Make the behavior of USE_STACKCHECK deterministic (#4098)

This change added the FIXME comment:

/* Due to the macros in which it's used, _Py_CheckRecursionLimit is in
   the stable ABI.  It should be removed therefrom when possible.
*/

--
components: C API
messages: 377317
nosy: vstinner
priority: normal
severity: normal
status: open
title: Remove _Py_CheckRecursionLimit variable
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com