[Python-Dev] PEP 340 -- concept clarification

Tim Peters tim.peters at gmail.com
Tue May 3 22:10:42 CEST 2005


...

[Jim Jewett]
>> qsize, empty, and full could be done with a lockself decorator.
>> Effectively, they *are* lockself decorators for the _xxx functions
>> that subclasses are told to override.

[Guido] 
> Actually you're pointing out a bug in the Queue module: these *should*
> be using a try/finally clause to ensure the mutex is released even if
> the inner call raises an exception.

Yup!  OTOH, if those dead-simple methods raised an exception, the
Queue has probably gone wholly insane anyway.

> I hadn't noticed these before because I was scanning only for "finally"
>
> If a locking primitive had been available, I'm sure it would have been
> used here.

That too.


More information about the Python-Dev mailing list