-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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-116750: Add clear_tool_id function to unregister events and callbacks #124568
Merged
Merged
Changes from 4 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
76f7716
Add clear_tool_id function to unregister events and callbacks
gaogaotiantian 81e1de0
📜🤖 Added by blurb_it.
blurb-it[bot] 6d1dfa9
Move tool version to code monitoring and force an instrument
gaogaotiantian 529e0df
Initialize tool versions
gaogaotiantian 151e3b3
Add an extra test for use after free
gaogaotiantian 5fb656e
Add comments
gaogaotiantian fd74a55
Only set tool verions for external tool ids
gaogaotiantian 82b42ec
Revert "Only set tool verions for external tool ids"
gaogaotiantian 9986702
Update comments
gaogaotiantian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
Misc/NEWS.d/next/Library/2024-09-26-00-35-24.gh-issue-116750.X1aMHI.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Provide :func:`sys.monitoring.clear_tool_id` to unregister all events and callbacks set by the tool. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like the version for
tool_id
will be the only one that matches the global version, which means thattool_id
will be the only tool with an up-to-date version number.Isn't that the opposite of what we want?
Maybe
interp->monitoring_tool_versions[tool_id] = 0
and leave the global version untouched?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to force all code object, executing or not, to "refresh" because the local events will be changed, so we need to update global version for the code objects to know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I understood you here. You think it would make sense to do
here so all the code objects checking
tool_id
will know they are out of date. However, setting it to the latest global version will have the same effect - none of the code object has this version either.If we set this to
0
, we need to set it to the latest global version some time in the future, before we use this tool to instrument code again.So we can either set it to
0
here and set it toglobal_version
inuse_tool_id
, or we can do it together here(I can add some. comments here to explain).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I was wrong in the previous comment. The update to global version is critical here because the user can set local events immediately after
clear_tool_id
.clear_tool_id
does not surrender thetool_id
. So we have to set the tool id version to the latest global version here for the following local events.