Skip to content

gh-69912: Document sys.getprofile() behavior with C profilers#143338

Open
heathdutton wants to merge 2 commits into
python:mainfrom
heathdutton:gh-69912-doc-sys-getprofile-setprofile-asymmetry
Open

gh-69912: Document sys.getprofile() behavior with C profilers#143338
heathdutton wants to merge 2 commits into
python:mainfrom
heathdutton:gh-69912-doc-sys-getprofile-setprofile-asymmetry

Conversation

@heathdutton
Copy link
Copy Markdown

@heathdutton heathdutton commented Jan 1, 2026

When a C profile function is in effect (such as one installed by cProfile), sys.getprofile() returns the internal profiler object rather than a callable. This object is not suitable for passing to sys.setprofile(), so saving and restoring the profiler state using this pair of functions may not work as expected.

This adds an implementation detail note to sys.getprofile() documenting this behavior, following the same pattern used for sys.gettrace().


📚 Documentation preview 📚: https://cpython-previews--143338.org.readthedocs.build/

@heathdutton heathdutton force-pushed the gh-69912-doc-sys-getprofile-setprofile-asymmetry branch from 4d52e80 to b8c412c Compare January 1, 2026 22:13
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label May 4, 2026
@read-the-docs-community
Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #32779508 | 📁 Comparing e821748 against main (87a879f)

  🔍 Preview build  

1 file changed
± library/sys.html

@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label May 25, 2026
@serhiy-storchaka
Copy link
Copy Markdown
Member

@birkenfeld, could you please review this PR?

@serhiy-storchaka serhiy-storchaka added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review docs Documentation in the Doc dir needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants