]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.14] gh-120158: Fix inconsistent monitoring state when setting events too frequentl...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 23 Nov 2025 15:31:56 +0000 (16:31 +0100)
committerGitHub <noreply@github.com>
Sun, 23 Nov 2025 15:31:56 +0000 (15:31 +0000)
commit1a798d30d8cb5ac3ff8b0b6ff9e458eb46e768aa
tree60dd996006a702744aeaabe2e1efd3f0c6b98944
parent59ab1edb0046addf7ff621cc293d2b19bf275cf5
[3.14] gh-120158: Fix inconsistent monitoring state when setting events too frequently (gh-141845) (gh-141879)

If we overflowed the global version counter (i.e., after 2*24 calls to
`_PyMonitoring_SetEvents`), we bailed out after setting global monitoring
events but before instrumenting code objects, which led to assertion errors
later on.

Also add a `time.sleep()` to `test_free_threading.test_monitoring` to avoid
overflowing the global version counter.
(cherry picked from commit e457d60daafe66534283e0f79c81517634408e57)

Co-authored-by: Sam Gross <colesbury@gmail.com>
Lib/test/test_free_threading/test_monitoring.py
Misc/NEWS.d/next/Core_and_Builtins/2025-11-22-10-43-26.gh-issue-120158.41_rXd.rst [new file with mode: 0644]
Python/instrumentation.c