Skip to content
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

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

Merged
merged 2 commits into from
Aug 8, 2024

Conversation

gaogaotiantian
Copy link
Member

@gaogaotiantian gaogaotiantian commented Jul 25, 2024

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
Member

encukou commented Aug 2, 2024

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
Member Author

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

Copy link
Member

@markshannon markshannon left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this

@gaogaotiantian gaogaotiantian merged commit 57d7c3e into python:main Aug 8, 2024
42 checks passed
@miss-islington-app
Copy link

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

bedevere-app bot commented Aug 8, 2024

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

@bedevere-app bedevere-app bot 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 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