Skip to content

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

Merged
markshannon merged 1 commit into
python:masterfrom
markshannon:cache-flineno-tracing-calls-returns
Jan 7, 2021
Merged

bpo-42823: Update frame.f_lineno before any call to the (C) tracing function.#24150
markshannon merged 1 commit into
python:masterfrom
markshannon:cache-flineno-tracing-calls-returns

Conversation

@markshannon

@markshannon markshannon commented Jan 7, 2021

Copy link
Copy Markdown
Member

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
Copy Markdown
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