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 ncoghlan
Recipients eric.araujo, ncoghlan, pitrou, sbt
Date 2012-02-25.09:49:53
SpamBayes Score 1.7394693e-09
Marked as misclassified No
Message-id <1330163394.71.0.305559291953.issue14116@psf.upfronthosting.co.za>
In-reply-to
Content
"with Lock() as lock:" doesn't make any sense - you need to share the lock with other threads or code for it be useful, which means you can't create it inline in the with statement header. Instead, you have to store it somewhere else (usually as a closure reference or a module, class or instance attribute) and then merely use it in the with statement to acquire and release it appropriately.

Absent a compelling use case, I'm inclined to reject this one - when there's no specifically useful value to return from __enter__, None, True or False are all reasonable alternatives.
History
Date User Action Args
2012-02-25 09:49:54ncoghlansetrecipients: + ncoghlan, pitrou, eric.araujo, sbt
2012-02-25 09:49:54ncoghlansetmessageid: <1330163394.71.0.305559291953.issue14116@psf.upfronthosting.co.za>
2012-02-25 09:49:54ncoghlanlinkissue14116 messages
2012-02-25 09:49:53ncoghlancreate