Message154161
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:
... |
|
Date |
User |
Action |
Args |
2012-02-24 21:03:01 | sbt | set | recipients:
+ sbt |
2012-02-24 21:03:01 | sbt | set | messageid: <1330117381.1.0.499178307418.issue14116@psf.upfronthosting.co.za> |
2012-02-24 21:03:00 | sbt | link | issue14116 messages |
2012-02-24 21:03:00 | sbt | create | |
|