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

Terry Reedy tjreedy at udel.edu
Tue Jan 31 23:07:53 CET 2012


On 1/31/2012 3:10 PM, Raymond Hettinger wrote:
>
> On Jan 29, 2012, at 6:11 PM, John O'Connor wrote:
>
>> On Sat, Jan 28, 2012 at 3:07 PM, Benjamin Peterson
>> <benjamin at python.org <mailto:benjamin at python.org>> wrote:
>>> But why would you want to pass a float? It seems like API abuse to me.
>>>
>>
>> Agreed. Anything else seems meaningless.
>
> I concur. This is very much a non-problem.
> There is no need to add more code and slow
> running time with superfluous type checks.

If it does not now, the doc could be changed to say that the arg must be 
an int, and behavior is undefined otherwise. Then the contract is clear.

-- 
Terry Jan Reedy



More information about the Python-Dev mailing list