cpython icon indicating copy to clipboard operation
cpython copied to clipboard

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

Open heathdutton opened this issue 2 weeks ago • 0 comments

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().

  • Issue: gh-69912

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

heathdutton avatar Jan 01 '26 22:01 heathdutton