-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nested profiling with cProfile raises exception in Python 3.12. #110770
Nested profiling with cProfile raises exception in Python 3.12. #110770
Comments
This is a delibrate change, well you can call it a breaking change, but it's not a bug. Nested profiler never (really) works in Python, the code you give is more like a "don't do this" example. It is equivalent (in Python 3.11) to import cProfile
p1 = cProfile.Profile()
p1.enable()
p2 = cProfile.Profile()
# p1 is silently disabled here
p1.disable()
p2.enable() That's not nested, that's just sequential profiling with two profilers - and if you really want to do that, you should be explicit! A nested profiler should either
Yes, the code given won't "report an error" in Python 3.11, but it also won't behave expectedly, it just keeps its mouth shut. I'd consider an error for "this is not how it's going to work!" as an improvement :) |
Bug report
Bug description:
In Python 3.11 this used to pass, but in Python 3.12 the last line raises “ValueError: Another profiling tool is already active”.
CPython versions tested on:
3.12
Operating systems tested on:
Linux
The text was updated successfully, but these errors were encountered: