[issue8799] Hang in lib/test/test_threading.py

Kristján Valur Jónsson report at bugs.python.org
Wed Apr 11 12:50:35 CEST 2012


Kristján Valur Jónsson <kristjan at ccpgames.com> added the comment:

> But, once again, "the condition may not yet hold true" is false.
In our current implementation, yes.  But it is intentionally left undefined in the specification of the condition variable protocol, for very good reasons.
While I'm fine with not mentioning it in the docs, I would be very much against us actually specifying the opposite (that early wakeups never occur) because this will unnecessarily limit our options.  Since the while() loop pattern is already recommended because of the "stolen wakeup" problem, leaving the "early/spurious" wakeup behaviour" undefined is wise, since there is nothing to be gained by actually guaranteeing that there will be no early wakeups.  This is just good software engineering practice.

This is also why we, IMHO, shouldn't rely on this behaviour in the unittests.  One should never write tests that depend on unspecified behaviour, again, good engineering practice.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8799>
_______________________________________


More information about the Python-bugs-list mailing list