Skip to content

gh-122247: Move instruction instrumentation sanity check after tracing check - #122251

Merged
gaogaotiantian merged 2 commits into
python:mainfrom
gaogaotiantian:fix-instruction-assert
Aug 8, 2024
Merged

gh-122247: Move instruction instrumentation sanity check after tracing check#122251
gaogaotiantian merged 2 commits into
python:mainfrom
gaogaotiantian:fix-instruction-assert

Conversation

@gaogaotiantian

@gaogaotiantiangaogaotiantian commented Jul 25, 2024

Copy link
Copy Markdown
Member

Due to #117133, code objects are not always up to date. We do not instrument them if we are tracing - because no events will be generated anyway. Therefore, we should check tstate->tracing first for instruction instrumentation, and do the sanity check only when an event is about to be generated.

News is skipped because it's an assertion move. No actual behavior is changed to the end user.

@encukou

Copy link
Copy Markdown
Member

What's a good way to learn about the invariants attached to the internal fields like _co_instrumentation_version? It's usually possible to deduce the intent from the code -- but that doesn't quite work when the code is incorrect.

The patch looks good to me, but I don't feel qualified to review it.

@gaogaotiantian

Copy link
Copy Markdown
MemberAuthor

Unfortunately a lot of the instrumentation related internal fields are undocumented - I basically read the source code to understand those.

@markshannonmarkshannon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this

@miss-islington-app

Copy link
Copy Markdown

Thanks @gaogaotiantian for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@gaogaotiantian
gaogaotiantian deleted the fix-instruction-assert branch August 8, 2024 04:30
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 8, 2024
…tracing check (pythonGH-122251)
(cherry picked from commit 57d7c3e)
Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
@bedevere-app

Copy link
Copy Markdown

GH-122812 is a backport of this pull request to the 3.13 branch.

@bedevere-appbedevere-appBot removed the needs backport to 3.13 bugs and security fixes label Aug 8, 2024
encukou pushed a commit that referenced this pull request Aug 16, 2024
… tracing check (GH-122251) (GH-122812)
(cherry picked from commit 57d7c3e)
Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
blhsing pushed a commit to blhsing/cpython that referenced this pull request Aug 22, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@gaogaotiantian@encukou@markshannon