[issue11714] threading.Semaphore does not use try...finally

2011-03-31 Thread Thomas Rachel
Thomas Rachel 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 <http://bugs.python.org/issue11

[issue11714] threading.Semaphore does not use try...finally

2011-03-31 Thread Thomas Rachel
Thomas Rachel 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 help backporting it to 2

[issue11714] threading.Semaphore does not use try...finally

2011-03-29 Thread Thomas Rachel
Thomas Rachel 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: http://bugs.python.org/file21460/th

[issue11714] threading.Semaphore does not use try...finally

2011-03-29 Thread Thomas Rachel
Thomas Rachel 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 returning from acquire

[issue11714] threading.Semaphore does not use try...finally

2011-03-29 Thread Thomas Rachel
New submission from Thomas Rachel : 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() [...] self