[issue42705] Intercepting thread lock objects not working under context managers

Mohamad Kanj report at bugs.python.org
Mon Dec 21 16:51:51 EST 2020


Mohamad Kanj <mhmd.kanj at gmail.com> added the comment:

Thanks Raymond for the input.
So with some experimentation, the __enter__() & __exit__() functions could be traceable when other kinds of objects are used with the context manager (i.e with statement using file IO or custom class objects). However, just when the object is a Lock object, then this is not the case anymore - which basically shows an unusual behavior if we were to think that such statements are executed for a specific thread. Also please mind that the threading module already implements settrace() and setprofile() methods like the sys module to extend tracing capabilities.

----------

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


More information about the Python-bugs-list mailing list