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

Facundo Batista facundobatista at gmail.com
Sat Oct 20 00:22:35 CEST 2007


Hi!

I was looking to this bug:   http://bugs.python.org/issue1255

It basically creates a deadlock in Python by doing the following:

- aa.py imports bb.py
- bb.py imports time and generates a thread
- the thread uses time.strptime

The deadlock is because the strptime function imports another module,
line 517 of timemodule.c:

      PyObject *strptime_module = PyImport_ImportModule("_strptime");

This situation is well known, found a lot of references to this
import-thread-import problem in discussions and previous bugs (i.e.:
http://bugs.python.org/issue683658).

What I did *not* find, and why I'm asking here, is how to solve it.

Exists a known solution to this?

Thank you!

-- 
.    Facundo

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


More information about the Python-Dev mailing list