GeezerVison is showing github.com — `Py_EnterRecursiveCall()`/`_Py_EnterRecursiveCall()` return value misused in a number of places · Issue #101965 · python/cpython
Py_EnterRecursiveCall()/_Py_EnterRecursiveCall() return value misused in a number of places #101965
DescriptionUsing grep, I identified 3 instances in main where code checks if Py_EnterRecursiveCall(...) < 0 (which just returns _Py_EnterRecursiveCall(...)) or _Py_EnterRecursiveCall(...) < 0.
Py_EnterRecursiveCall() documentation only guarantees that a nonzero value is returned in the event of an error.
- The actual implementation can't return a negative value:
|
static inline int _Py_EnterRecursiveCallTstate(PyThreadState *tstate, |
|
const char *where) { |
|
return (_Py_MakeRecCheck(tstate) && _Py_CheckRecursiveCall(tstate, where)); |
|
} |
|
|
|
static inline int _Py_EnterRecursiveCall(const char *where) { |
|
PyThreadState *tstate = _PyThreadState_GET(); |
|
return _Py_EnterRecursiveCallTstate(tstate, where); |
|
} |
Linked PRs
Activitychanged the title [-]`Py_EnterRecursiveCall()`/`_Py_EnterRecursiveCall()` return value misused in a number of places in `main`[/-] [+]`Py_EnterRecursiveCall()`/`_Py_EnterRecursiveCall()` return value misused in a number of places[/+] on Feb 16, 2023erlend-aasland commented on Feb 20, 2023 Thanks for the report, Owain! In this case, I think we can close it as obsolete bco. Irit's patch #102078. Thanks for your interest in improving CPython :) OTheDev commented on Feb 20, 2023 ContributorAuthor More actions @erlend-aasland Thanks! However, Irit's patch does not fix the instances in the bisect module. Will it be addressed there? erlend-aasland commented on Feb 20, 2023
@erlend-aasland Thanks! However, Irit's patch does not fix the instances in the bisect module. Will it be addressed there?
Well observed! Check with Irit on her PR. I'm guessing it is out of scope for her PR. In that case we'll reopen this and you can update your PR to target the remaining issues. added a commit that references this issue on Feb 21, 2023gh-101965: Fix usage of Py_EnterRecursiveCall return value in _bisect…
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|