Skip to content

Commit

Permalink
[3.12] gh-109357: Fix test_monitoring.test_gh108976() (GH-109358) (#1…
Browse files Browse the repository at this point in the history
…09359)

gh-109357: Fix test_monitoring.test_gh108976() (GH-109358)

The test now calls free_tool_id() so it can be run multiple times in
the same process. For example, the following command no longer fails:

    python -m test test_monitoring -R 3:3
(cherry picked from commit 388d91c)

Co-authored-by: Victor Stinner <[email protected]>
  • Loading branch information
miss-islington and vstinner authored Sep 13, 2023
1 parent aee0077 commit 3d8e4d7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Lib/test/test_monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -1721,6 +1721,7 @@ def make_foo_optimized_then_set_event():

def test_gh108976(self):
sys.monitoring.use_tool_id(0, "test")
self.addCleanup(sys.monitoring.free_tool_id, 0)
sys.monitoring.set_events(0, 0)
sys.monitoring.register_callback(0, E.LINE, lambda *args: sys.monitoring.set_events(0, 0))
sys.monitoring.register_callback(0, E.INSTRUCTION, lambda *args: 0)
Expand Down

0 comments on commit 3d8e4d7

Please sign in to comment.