What was up with posixfile

Matt Mackall mpm at selenic.com
Fri Apr 3 11:45:52 CDT 2009


So I debugged this last night.

When setup.py determines the version number before building extensions,
it runs Mercurial in 'pure' mode by adding mercurial/pure to sys.path.

Some of the pure/ modules were doing things like:

 import util

And this was subtly wrong. This in fact caused util to get fully
imported a second time in a different scope. And the second time, its
own call to

 import posix

would load the built-in module rather than the one in mercurial/.

The fix for this is to change the pure modules to do:

 from mercurial import util

which does the right thing without requiring renaming posix.py or any
other silliness.

I've got fixes for this in my queue which I'll push out shortly.

Along the way, I fixed up a bunch of circular imports. The biggest of
these was util->i18n->util for the encoding functions. So I decided it
was time to move all the encoding stuff to its own module, encoding.

-- 
http://selenic.com : development and support for Mercurial and Linux




More information about the Mercurial-devel mailing list