cpython
cpython copied to clipboard
gh-69912: Document sys.getprofile() behavior with C profilers
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/