Message353415
As a note on the general pattern, a user at work diagnosed a ^C problem in their code when running on 2.7 to be due to Queue.get's
acquire()
try:
...
finally:
release()
Pattern, with the KeyboardInterrupt triggering after acquire() but before the try is entered. so release() is never called.
A try finally pattern that probably alleviates this by entering the try block first might look like:
try:
acquire()
...
finally:
try:
release()
except ThreadError:
pass # interrupted before acquire() succeeded.
It'd be a shame if any with statements lock acquisition context managers need to be turned into that, but I _believe_ it'd be a viable workaround for the time being if this race is found to be biting anyone. |
|
Date |
User |
Action |
Args |
2019-09-27 21:20:31 | gregory.p.smith | set | recipients:
+ gregory.p.smith, rhettinger, ncoghlan, njs, Mark.Shannon, erik.bray, serhiy.storchaka, jdemeyer, yselivanov, deleted0524, ryanhiebert, xgdomingo |
2019-09-27 21:20:31 | gregory.p.smith | set | messageid: <1569619231.21.0.103838758001.issue29988@roundup.psfhosted.org> |
2019-09-27 21:20:31 | gregory.p.smith | link | issue29988 messages |
2019-09-27 21:20:31 | gregory.p.smith | create | |
|