GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Use static inline function Py_EnterRecursiveCall() by vstinner · Pull Request #91988 · python/cpython

Conversation

@vstinner

@vstinner vstinner commented Apr 27, 2022

Copy link
Copy Markdown
Member

Currently, calling Py_EnterRecursiveCall() and
Py_LeaveRecursiveCall() may use a function call or a static inline
function call, depending if the internal pycore_ceval.h header file
is included or not. Use a different name for the static inline
function to ensure that the static inline function is always used in
Python internals for best performance. Similar approach than
PyThreadState_GET() (function call) and _PyThreadState_GET() (static
inline function).

  • Rename _Py_EnterRecursiveCall() to _Py_EnterRecursiveCallTstate()
  • Rename _Py_LeaveRecursiveCall() to _Py_LeaveRecursiveCallTstate()
  • pycore_ceval.c: Rename Py_EnterRecursiveCall() to
    _Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() and
    _Py_LeaveRecursiveCall()

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vstinner vstinner added skip issue skip news labels Apr 27, 2022
@vstinner
vstinner requested review from iritkatriel, isidentical and markshannon as code owners April 27, 2022 14:10
@bedevere-bot bedevere-bot added the awaiting core review label Apr 27, 2022
@vstinner

vstinner commented Apr 27, 2022

Copy link
Copy Markdown
Member Author

I'm not convinced that the performance of the static inline function is worth it. Maybe it can just be removed to only keep the variant with a tstate parameter?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner
Use static inline function Py_EnterRecursiveCall()
7b36c55
Currently, calling Py_EnterRecursiveCall() and
Py_LeaveRecursiveCall() may use a function call or a static inline
function call, depending if the internal pycore_ceval.h header file
is included or not. Use a different name for the static inline
function to ensure that the static inline function is always used in
Python internals for best performance. Similar approach than
PyThreadState_GET() (function call) and _PyThreadState_GET() (static
inline function).

* Rename _Py_EnterRecursiveCall() to _Py_EnterRecursiveCallTstate()
* Rename _Py_LeaveRecursiveCall() to _Py_LeaveRecursiveCallTstate()
* pycore_ceval.c: Rename Py_EnterRecursiveCall() to
  _Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() and
  _Py_LeaveRecursiveCall()
@vstinner
vstinner merged commit d716a0d into python:main May 4, 2022
@bedevere-bot bedevere-bot removed the awaiting core review label May 4, 2022
@vstinner
vstinner deleted the enter_recursive_call branch May 4, 2022 11:30
@OTheDev OTheDev mentioned this pull request Feb 14, 2023
gh-101903: Remove unnecessary undefs for non-existent/old macros Py_EnterRecursiveCall and Py_LeaveRecursiveCall #101923
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@isidentical isidentical Awaiting requested review from isidentical
@iritkatriel iritkatriel Awaiting requested review from iritkatriel iritkatriel is a code owner
@markshannon markshannon Awaiting requested review from markshannon markshannon is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip issue skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@vstinner @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.