[issue32317] sys.exc_clear() clears exception in other stack frames

2017-12-13 Thread Garrett Berg
Garrett Berg <googb...@gmail.com> added the comment: I found a workaround, and probably the reason this has not been detected before: import sys def doclear2() try: 1/0 except ZeroDivisionError: sys.exc_clear() try: 1/0

[issue32317] sys.exc_clear() clears exception in other stack frames

2017-12-13 Thread Garrett Berg
New submission from Garrett Berg <googb...@gmail.com>: # Summary In python (2 or 3) it should always be valid to have a bare *raise* statement in an exception block. try: do_something() except SomeException: do_cleanup() raise # always reraises SomeExc

[issue32317] sys.exc_clear() clears exception in other stack frames

2017-12-13 Thread Garrett Berg
Garrett Berg <googb...@gmail.com> added the comment: I forgot to post this: python --v

[issue32208] Improve semaphore documentation

2017-12-04 Thread Garrett Berg
Garrett Berg <googb...@gmail.com> added the comment: Gave it a shot! -- keywords: +patch pull_requests: +4620 stage: needs patch -> patch review ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

[issue32208] Improve semaphore docmentation

2017-12-03 Thread Garrett Berg
Garrett Berg <googb...@gmail.com> added the comment: It may be desirable to change: > Once awoken, decrement the counter by 1. to > Once awoke, decrement the counter (which is guaranteed to be positive) by 1. Although this could be considered obvious since the counter can ne

[issue32208] Improve semaphore docmentation

2017-12-03 Thread Garrett Berg
Garrett Berg <googb...@gmail.com> added the comment: Also, is "The order in which threads are awoken should not be relied on" actually true? Would it not be up to the OS specific scheduler? For instance, wouldn't the POSIX scheduler use a priority qu

[issue32208] Improve semaphore docmentation

2017-12-03 Thread Garrett Berg
New submission from Garrett Berg <googb...@gmail.com>: The definition of threading.Semaphore is confusing (for all versions of python docs) https://docs.python.org/2/library/threading.html#semaphore-objects acquire([blocking]) It currently states the following: > When invoke