[Python-Dev] Deadlock by a second import in a thread

Facundo Batista facundobatista at gmail.com
Sat Oct 20 16:22:34 CEST 2007


2007/10/20, Nick Coghlan <ncoghlan at gmail.com>:

> bb.py is broken - importing a module should never spawn a new thread as
> a side effect (precisely because it will deadlock if the spawned thread
> tries to do an import, which can happen in a myriad of ways).

Agreed.

But if we move the import of the _strptime module to do it once when
"time" is imported, we enhance the "least surprise" situation (and has
a marginal performance benefit of not trying to import it again every
time.strptime() call).

And even solves this bug, which does not hurt enaybody, ;)

Regards,

-- 
.    Facundo

Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/


More information about the Python-Dev mailing list