Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:
A few thoughts: * We normally say "all bets are off" when it comes to manipulating Python internals with ctypes. This issue is just one of many ways to wreak havoc. * The programming pattern of killing running threads at arbitrary points in their execution is inherently fragile. I don't think other modules are obliged to try to support it. * The pattern of "acquire(); try: something(); finally release();" is common. Logging is only of many modules in the ecosystem that use this pattern. * ISTM we can't assume that the lock is a context manager because createLock() is a public method and users can do anything with it. * That said, we could add our own __enter__ and __exit__ methods to the Handler class. * Lastly, I have a vague memory that at one point there was a rejected proposal to switch logging to use the with-statement throughout. We should research that to see if the reasoning is still applicable or not. ---------- nosy: +pitrou, rhettinger versions: -Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue43939> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com