homepage

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 sbt
Recipients sbt
Date 2012年02月24日.21:03:00
SpamBayes Score 2.2256022e-06
Marked as misclassified No
Message-id <1330117381.1.0.499178307418.issue14116@psf.upfronthosting.co.za>
In-reply-to
Content
The __enter__() methods of Lock, RLock, Semaphore and Condition in threading (and multiprocessing) all return True. This seems to contradict the documentation for the context protocol which says
 contextmanager.__enter__()
 Enter the runtime context and return either this object or 
 another object related to the runtime context. The value 
 returned by this method is bound to the identifier in the
 as clause of with statements using this context manager.
 ...
I don't think True qualifies as "another object related to the runtime context".
It looks like an oversight caused by making __enter__() an alias for acquire(). Is it reasonable to change this for 3.3? I tripped over the issue when I tried writing
 with Condition() as c:
 ...
History
Date User Action Args
2012年02月24日 21:03:01sbtsetrecipients: + sbt
2012年02月24日 21:03:01sbtsetmessageid: <1330117381.1.0.499178307418.issue14116@psf.upfronthosting.co.za>
2012年02月24日 21:03:00sbtlinkissue14116 messages
2012年02月24日 21:03:00sbtcreate

AltStyle によって変換されたページ (->オリジナル) /