[issue46896] add support for watching writes to selected dictionaries

Gregory P. Smith report at bugs.python.org
Thu Mar 3 15:44:21 EST 2022


Gregory P. Smith <greg at krypto.org> added the comment:

Per interpreter seems best.

If someone using this feature writes a buggy implementation of a callback that doesn't chain reliably, that is a bug in their code and all of the fallout from that is "just" a bug to be fixed in said code.

Think of it like a C signal handler, the OS doesn't chain for you - it is the signal handler installer's responsibility to chain to the previous one.  Not an unusual pattern for callback hooks in C.

We already have such global C callback hooks in SetProfile and SetTrace. https://docs.python.org/3/c-api/init.html#profiling-and-tracing

Those don't even provide for chaining.  We could do the same here and not let a hook be set more than once instead of providing a Get API to allow for manual chaining.  That seems less useful.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46896>
_______________________________________


More information about the Python-bugs-list mailing list