Skip to content

bpo-38644: Pass tstate to Py_EnterRecursiveCall() #16997

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 4, 2019
Merged

bpo-38644: Pass tstate to Py_EnterRecursiveCall() #16997

merged 1 commit into from
Nov 4, 2019

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Oct 30, 2019

  • Convert Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() macros
    to static inline functions.
  • Pass tstate to _Py_MakeRecCheck() and _Py_CheckRecursiveCall().
  • Add _Py_EnterRecursiveCall() and _Py_LeaveRecursiveCall() which
    require a tstate argument.

https://bugs.python.org/issue38644

@vstinner vstinner requested a review from a team as a code owner November 4, 2019 16:42
@vstinner vstinner changed the title bpo-38644: Pass tstate to Py_EnterRecursiveCall() [WIP] bpo-38644: Pass tstate to Py_EnterRecursiveCall() Nov 4, 2019
@vstinner
Copy link
Member Author

vstinner commented Nov 4, 2019

I fixed the build on Windows: I had to fix the macro for the limited API.

I wrote PR #17046 to only fix the API for the limited API. Once PR #17046 will be merged, I will rebase this PR on top of it.

@vstinner vstinner changed the title [WIP] bpo-38644: Pass tstate to Py_EnterRecursiveCall() bpo-38644: Pass tstate to Py_EnterRecursiveCall() Nov 4, 2019
@vstinner
Copy link
Member Author

vstinner commented Nov 4, 2019

I wrote PR #17046 to only fix the API for the limited API. Once PR #17046 will be merged, I will rebase this PR on top of it.

Done.

* Add _Py_EnterRecursiveCall() and _Py_LeaveRecursiveCall() which
  require a tstate argument.
* Pass tstate to _Py_MakeRecCheck() and  _Py_CheckRecursiveCall().
* Convert Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() macros
  to static inline functions.

_PyThreadState_GET() is the most efficient way to get the tstate, and
so using it with _Py_EnterRecursiveCall() and
_Py_LeaveRecursiveCall() should be a little bit more efficient than
using Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() which use
the "slower" PyThreadState_GET().
@vstinner vstinner merged commit be434dc into python:master Nov 4, 2019
@vstinner vstinner deleted the recursive_tstate branch November 4, 2019 23:51
jacobneiltaylor pushed a commit to jacobneiltaylor/cpython that referenced this pull request Dec 5, 2019
* Add _Py_EnterRecursiveCall() and _Py_LeaveRecursiveCall() which
  require a tstate argument.
* Pass tstate to _Py_MakeRecCheck() and  _Py_CheckRecursiveCall().
* Convert Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() macros
  to static inline functions.

_PyThreadState_GET() is the most efficient way to get the tstate, and
so using it with _Py_EnterRecursiveCall() and
_Py_LeaveRecursiveCall() should be a little bit more efficient than
using Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() which use
the "slower" PyThreadState_GET().
shihai1991 pushed a commit to shihai1991/cpython that referenced this pull request Jan 31, 2020
* Add _Py_EnterRecursiveCall() and _Py_LeaveRecursiveCall() which
  require a tstate argument.
* Pass tstate to _Py_MakeRecCheck() and  _Py_CheckRecursiveCall().
* Convert Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() macros
  to static inline functions.

_PyThreadState_GET() is the most efficient way to get the tstate, and
so using it with _Py_EnterRecursiveCall() and
_Py_LeaveRecursiveCall() should be a little bit more efficient than
using Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() which use
the "slower" PyThreadState_GET().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants