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

Benjamin Peterson benjamin at python.org
Sat Jan 28 21:07:16 CET 2012


2012/1/28 T.B. <bauertomer at gmail.com>:

Hello python-dev,

This is probably worth of a bug report: While looking at threading.py I noticed that Semaphore's counter can go below zero. This is opposed to the docs: "The counter can never go below zero; ...". Just try: import threading s = threading.Semaphore(0.5)

But why would you want to pass a float? It seems like API abuse to me.

-- Regards, Benjamin



More information about the Python-Dev mailing list