Tim Peters <t...@python.org> added the comment:

While bundling the lock.release() into C makes that bulletproof, is there a 
bulletproof way to guarantee that `self._stop()` gets called if the 
acquire_and_release() succeeds? Offhand, I don't see a reason for why that 
isn't just as vulnerable to getting skipped due to an unfortunate signal.

Indeed, huge mounds of threading.py can leave things in insane states in the 
presence of by-magic exceptions. Even if code is very careful to put crucial 
cleanup code in `finally` blocks so it gets executed "no matter what", there's 
nothing to stop code in `finally` blocks from getting skipped over due to 
by-magic exceptions too.

It's an eternal marvel that anything ever works at all ;-)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46726>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to