Roundup Robot added the comment:
New changeset 2253b8a18bbf by Serhiy Storchaka in branch '2.7':
Issue #11714: Use 'with' statements to assure a Semaphore releases a
http://hg.python.org/cpython/rev/2253b8a18bbf
New changeset af30c5cb248f by Serhiy Storchaka in branch '3.3':
Issue #11714: Use
Serhiy Storchaka added the comment:
Thank you for the patch.
'try/finally' can't be replaced by 'with' statements in the _Event class
because a conditional variable should be reinitialized in
_reset_internal_locks() after fork.
--
resolution: - fixed
stage: commit review -
Serhiy Storchaka added the comment:
LGTM. 3.x patch a little desynchronized but it is easy to update it. I'll
commit it if Antoine have no objections.
Thomas Rachel, can you please submit a contributor form?
http://python.org/psf/contrib/contrib-form/
http://python.org/psf/contrib/
Thomas Rachel th.rac...@googlemail.com added the comment:
Oops, sorry. I have re-made it; it is to be applied to 69f58be4688a.
The original one was made against the respective file of my distribution which
contains Python 2.6. It can be applied to (at least) 787b969d37f0, a fact which
might
Thomas Rachel th.rac...@googlemail.com added the comment:
Here is another patch which fits to 2.7, if desired.
--
Added file: http://bugs.python.org/file21496/threading.b36cb4602e21.patch
___
Python tracker rep...@bugs.python.org
Antoine Pitrou pit...@free.fr added the comment:
What version of Python did you make your patch against? It failed applying
against the default branch.
You might want to make sure you are using an up-to-date source tree, see:
http://docs.python.org/devguide/setup.html#getting-the-source-code
New submission from Thomas Rachel th.rac...@googlemail.com:
The acquire() and release() functions of threading.Semaphore do not make use of
the try...finally suite as it would be reasonable.
They just do
def acquire(self, blocking=1):
rc = False
self.__cond.acquire()
Thomas Rachel th.rac...@googlemail.com added the comment:
I wonder if it is right what I wrote. After a second thought, the acquire()
should come *after* try:, as well in threading.Event. Because if Ctrl-C is
pressed while waiting in acquire(), a KeyboardInterrupt is thrown immediately
after
Thomas Rachel th.rac...@googlemail.com added the comment:
Of course.
I hope it is correct, and I hop it is ok when I change to use with ...: on
the other places I consider it useful as well...
--
keywords: +patch
type: - behavior
Added file:
Antoine Pitrou pit...@free.fr added the comment:
It would be simpler to use with indeed.
Do you want to provide a patch?
--
nosy: +pitrou
versions: +Python 3.3 -Python 2.6, Python 3.1
___
Python tracker rep...@bugs.python.org
10 matches
Mail list logo