This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gregory.p.smith
Recipients Mark.Shannon, deleted0524, erik.bray, gregory.p.smith, jdemeyer, ncoghlan, njs, rhettinger, ryanhiebert, serhiy.storchaka, xgdomingo, yselivanov
Date 2019-09-27.21:20:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1569619231.21.0.103838758001.issue29988@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2019-09-27 21:20:31gregory.p.smithsetrecipients: + gregory.p.smith, rhettinger, ncoghlan, njs, Mark.Shannon, erik.bray, serhiy.storchaka, jdemeyer, yselivanov, deleted0524, ryanhiebert, xgdomingo
2019-09-27 21:20:31gregory.p.smithsetmessageid: <1569619231.21.0.103838758001.issue29988@roundup.psfhosted.org>
2019-09-27 21:20:31gregory.p.smithlinkissue29988 messages
2019-09-27 21:20:31gregory.p.smithcreate