Repository navigation
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #159117.
profiler_dealloc()still called_PyEval_SetProfile(tstate, NULL, NULL), although_lsprofnow usessys.monitoring. Destroying an enabled profiler after its monitoring callbacks have been released therefore cleared an unrelatedsys.setprofile()callback.When a cyclic profiler is collected during
ProfileTest.do_profiling(), this can stop the pure Python profiler before it has recorded all calls, producing empty or partial statistics.Remove the obsolete cleanup and its unused headers. Monitoring callbacks hold references to the profiler while registered, so deallocation does not need to unregister them. Add a deterministic regression test that releases an enabled profiler's monitoring callbacks, destroys it, and verifies that an independent
sys.setprofile()callback remains installed. Include a NEWS entry.Validation on a Windows AMD64 CPython 3.16 debug build:
sys.getprofile()returnsNone) and passes afterward.PCbuild\amd64\python_d.exe -m test -j2 test_profile test_profiling test_sys_setprofile test_monitoring test_pstatspasses (629 tests reported, 16 skipped).PCbuild\amd64\python_d.exe -m test -j1 -R3:3 test_profile test.test_profiling.test_tracing_profilerpasses with no detected reference leaks.git diff --cached --check, and CPython patchcheck pass.The original Windows PGO tail-call and s390x buildbot configurations were not tested locally.