pure module loading issues with stable tip
martin at geisler.net
Fri Aug 24 10:01:10 CDT 2012
Adrian Buehlmann <adrian at cadifra.com> writes:
> On 2012-08-24 13:04, Martin Geisler wrote:
>> Steve Borho <steve at borho.org> writes:
>>> obsolete.py is importing the base85 module with a "from" statement:
>>> from mercurial import util, base85
>>> If one is using the pure Python extensions by adding mercurial/pure to
>>> sys.path, this import statement breaks.
>> As far as I know, this isn't how --pure works -- the files in
>> mercurial/pure are copied into mercurial/ and so sys.path is not
>> supposed to be modified.
> setup.py does it:
> Steve's patch looks good to me.
Okay, I see now -- I knew that setup.py used the pure code to bootstrap
Mercurial, but I had not thought about how it would change things if a C
extension is imported with 'from mercurial import X'.
This suggests that we should use relative imports everywhere: instead of
from mercurial import X
when the importing module is already in mercurial. Older code already
does this, but I think there is a tendency for new code to use the
(IMHO) more logical and explicit 'from mercurial import X' style.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 835 bytes
Desc: not available
More information about the Mercurial-devel