This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Remove macros Py_ALLOW_RECURSION/Py_END_ALLOW_RECURSION
Type: enhancement Stage: resolved
Components: C API Versions: Python 3.10
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: gvanrossum, serhiy.storchaka, vstinner
Priority: normal Keywords: patch

Created on 2020-10-04 22:20 by serhiy.storchaka, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 22552 merged serhiy.storchaka, 2020-10-04 22:30
Messages (3)
msg377978 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-10-04 22:20
Macros Py_ALLOW_RECURSION and Py_END_ALLOW_RECURSION together with field recursion_critical of the PyInterpreterState structure were added in 5b222135f8d2492713994f2cb003980e87ce6a72 but were never documented. It seems that the reason of adding them was to work around the fact that PyDict_GetItem() can silence any exception including recursion error. But PyDict_GetItem() no longer used in that code and the macros are also no longer used (see issue41909).

GvR proposed to remove these macros. I think that recursion_critical can be removed too.
msg378002 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-10-05 08:38
I failed to find users of these macros outside the CPython code base, so it sounds safe to remove it, especially if it's documented in What's New in Python 3.10.

If someone reports the removal as a regression and describes a legit use case, we can reconsider to revert the removal. Until that, I'm fine with removing them.

--

I ran grep on Cython and numpy code base: I cannot find "Py_ALLOW_RECURSION", "Py_END_ALLOW_RECURSION" or "recursion_critical".

On GitHub, I only found copies of Include/ceval.h (I looked at the first 5 pages of result):
https://github.com/search?l=C&q=Py_ALLOW_RECURSION&type=Code
msg378010 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-10-05 09:32
New changeset dcc54215ac1eb4b6fab2a9ffe1abcdf3ac4bb77e by Serhiy Storchaka in branch 'master':
bpo-41936. Remove macros Py_ALLOW_RECURSION/Py_END_ALLOW_RECURSION (GH-22552)
https://github.com/python/cpython/commit/dcc54215ac1eb4b6fab2a9ffe1abcdf3ac4bb77e
History
Date User Action Args
2022-04-11 14:59:36adminsetgithub: 86102
2020-10-05 09:32:22serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-10-05 09:32:07serhiy.storchakasetmessages: + msg378010
2020-10-05 08:38:23vstinnersetmessages: + msg378002
2020-10-04 22:30:25serhiy.storchakasetkeywords: + patch
stage: patch review
pull_requests: + pull_request21550
2020-10-04 22:20:31serhiy.storchakacreate