[Python-Dev] Import lock considered mysterious

Antoine Pitrou solipsis at pitrou.net
Fri Jul 22 14:48:58 CEST 2011


On Fri, 22 Jul 2011 21:29:23 +1200
Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> 
> This whole episode seems to have resulted from a collision
> between two rather obscure things: that import statements
> involve locking things, and that some fairly innocuous
> looking calls, such as s.encode('ascii'), can trigger an
> import.

Indeed.

> I'm wondering whether anything can be done to make problems
> like this less likely to occur, or at least to make the
> cause more readily apparent. One shouldn't really have to
> use gdb to track down bugs in Python code.

See http://bugs.python.org/issue9260

There's a patch there but it needs additional sophistication to remove
deadlocks when doing concurrent circular imports.

Regards

Antoine.




More information about the Python-Dev mailing list