Skip to content

[3.14] gh-159739: Guard cProfile against reentry while processing an external timer (GH-160405) - #160567

Open
miss-islington wants to merge 1 commit into
python:3.14from
miss-islington:backport-c2b7e0a-3.14
Open

miss-islington wants to merge 1 commit into
python:3.14from
miss-islington:backport-c2b7e0a-3.14

Conversation

@miss-islington

@miss-islington miss-islington commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

An external timer can run Python again when the profiler converts or releases its result or reports an unraisable exception. Calling clear() or disable() at that point could free a profiling context still in use. Calling Profiler.init() from the timer could also destroy the active callable. Keep the guard active through result handling and reject reinitialization while an external timer is running.
(cherry picked from commit c2b7e0a)

Co-authored-by: Jelle Zijlstra jelle@openai.com

…xternal timer (pythonGH-160405)

An external timer can run Python again when the profiler converts or releases its result or reports an unraisable exception. Calling clear() or disable() at that point could free a profiling context still in use. Calling Profiler.__init__() from the timer could also destroy the active callable. Keep the guard active through result handling and reject reinitialization while an external timer is running.
(cherry picked from commit c2b7e0a)

Co-authored-by: Jelle Zijlstra <jelle@openai.com>
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.

2 participants