[issue1255] Strange Python hangup

Facundo Batista report at bugs.python.org
Fri Oct 26 04:38:23 CEST 2007


Facundo Batista added the comment:

The deadlock happens because strptime has an import inside it, and
recursive imports are not allowed in different threads.

As a general rule and good coding style, don't run your code when the
module is imported, but put it in a function like "main" in the second
file,import it and call it from the first one. This will solve your problem.

Note that this happens to you with strptime, but could happen with a
lot, *a lot*, of functions that do this internal import of something
else. So, you'll never be sure.

You can follow the python-dev thread titled "Deadlock by a second import
in a thread" for more info.

----------
nosy: +facundobatista
resolution:  -> wont fix
status: open -> closed

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1255>
__________________________________


More information about the Python-bugs-list mailing list