[Python-Dev] Import lock considered mysterious

Antoine Pitrou solipsis at pitrou.net
Fri Jul 22 17:07:07 CEST 2011


> >See http://bugs.python.org/issue9260
> >
> >There's a patch there but it needs additional sophistication to remove
> >deadlocks when doing concurrent circular imports.
> 
> I don't think that approach can work, as PEP 302 loaders can 
> currently assume the global import lock is being held when they 
> run...  and in general, there are too many global data structures in 
> sys that need to be protected by code that uses such things.

Some of the comments in the issue are about that. The global import lock
could *still* protect those structures when needed. It just doesn't have
to be held when executing a module's body.

> Between that and the timeout, the mysteriousness could be completely 
> done away with, without throwing a monkey wrench into the current 
> import mechanisms.

Isn't the current import mechanism already a monkey wrench?

Regards

Antoine.




More information about the Python-Dev mailing list