[Python-Dev] threading.Semaphore()'s counter can become negative for non-ints

Victor Stinner victor.stinner at haypocalc.com
Mon Jan 30 00:46:32 CET 2012


>> import threading
>> s = threading.Semaphore(0.5)
>
> But why would you want to pass a float? It seems like API abuse to me.

If something should be changed, Semaphore(arg) should raise a
TypeError if arg is not an integer.

Victor


More information about the Python-Dev mailing list