Replies: 2 comments 1 reply
-
Hi Petr. Thanks for looking in to this! I'd imagined the audit hooks would only be enabled in debug mode. That way we could inform devs that they may be doing something wrong. The audit hooks would generally be disabled when the app is shipped. I'm sure we would make use of the audit hook if it was available. Any slowdown is probably not going to be much of an issue for us... |
Beta Was this translation helpful? Give feedback.
0 replies
-
Python 3.13.0alpha 1 is now out and it emits an auditing event for |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
Some time ago Will complained on Twitter that users use
time.sleep
for experiments. Let's complain when they do that!To be clear: for finding blocking code in an asynchronous app, you should use a profiler, watchdog task, or similar. This issue is about adding a hint to people who don't understand or care about asynchrony, and just wanna write a TUI.
Unfortunately, most ways of detecting
time.sleep
are ugly: suggestions include monkey-patchingtime
or analyzing AST .Adding an audit event sounds like a plausible solution. I can add that to Python 3.13+, but I need cooperation from you. Specifically, I only want to add it if we can prove that it'll be useful to you.
The worry is about is performance. Audit events are cheap, but using a Python function as an audit hook might noticeably slow down all auditable events (not just sleep).
If it's too slow, it's possible to optimize -- but let's measure first. You're the best team to do that :)
Could you:
sleep
added at the start.Beta Was this translation helpful? Give feedback.
All reactions