Skip to content

bpo-42823: Update frame.f_lineno before any call to the (C) tracing function. #24150

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

Conversation

markshannon
Copy link
Member

@markshannon markshannon commented Jan 7, 2021

Minimizes breakage and ensures PyFrame_GetLineNumber is efficient.

This PR sets the C field frame.f_lineno to the actual line number before any call to a tracing function, and sets it back to zero after the call. This:

  1. Minimizes breakage of C code that assumes that the the C field frame.f_lineno always holds same value as the Python attribute
  2. Makes PyFrame_GetLineNumber() efficient, as it will not need to do any computation when called within a tracing function.

Should have no effect when tracing is turned off.

https://bugs.python.org/issue42823

…nimizes breakage and ensures PyFrame_GetLineNumber is efficient.
@markshannon
Copy link
Member Author

Skipping NEWS as there is nothing new here

@markshannon markshannon merged commit 8643345 into python:master Jan 7, 2021
@markshannon markshannon deleted the cache-flineno-tracing-calls-returns branch January 7, 2021 16:49
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 13, 2021
…ythonGH-24150)

* Minimizes breakage of C extensions and ensures PyFrame_GetLineNumber is efficient.
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