Unusual minidom behaviour: Part Deux

Guido van Rossum guido at python.org
Thu Jul 26 09:59:42 EDT 2001


Martin von Loewis <loewis at informatik.hu-berlin.de> writes:

> "Victor Bazarov" <vAbazarov at dAnai.com> writes:
> 
> > Further digging led me to the C source module that contained some
> > comment "this is to prevent two threads from importing the same
> > module at the same time returning incomplete module" (or something
> > like that).  I didn't try to comprehend the C source, sorry.
> > Although it may not be so difficult, I prefer to leave fixing to
> > those for whom the system is an open book.
> 
> Even if you didn't understand the source, it would have been nice if
> you had indicated what source you were looking at; I could not find
> any occurrence of "this is to prevent" in the entire Python source
> code.

He's referring to the import_lock variable in import.c.

> > Understanding that Python thread mechanism does not use the OS
> > thread mechanism
> 
> This is a misunderstanding: the Python thread mechanism does use the
> OS thread mechanism

Just under a layer of wrapper APIs.

> > and with all due respect to the creators and contributors, I would
> > like to ask, "Has anybody experienced similar situation with more
> > than one thread competing for the same module?"
> 
> I'm out of context here: a situation similar to what?

The only situation where I've seen this, ironically, is if you attempt
to import the test module that's designed specifically to test this
lock, in the interactive interpreter on Windows.

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-list mailing list