Skip to content

Conversation

@heathdutton
Copy link

@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
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 skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant