Mercurial > hg
comparison contrib/mercurial.spec @ 11942:50a4e55aa278
demandimport: store level argument on _demandmod instances
The 'level' argument to __import__ was added in Python 2.6, and is
specified for either relative or absolute imports. The fix introduced
in e160f2312815 allowed such imports to proceed without failure, but
effectively disabled demandimport for them. This is particularly
unfortunate in Python 3.x, where *all* imports are either relative or
absolute.
The solution introduced here is to store the level argument on the
demandimport instance, and propagate it to _origimport() when its
value isn't None.
Please note that this patch hasn't been tested in Python 3.x, and thus
may not be complete. I'm worried about how sub-imports are handled; I
don't know what they are, or whether the level argument should be
modified for them. I've added 'TODO' notes to these cases; hopefully,
someone more knowledgable of these issues will deal with them.
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Tue, 17 Aug 2010 17:46:10 +0200 |
parents | 85de44ae0238 |
children | 85439f43749f |
comparison
equal
deleted
inserted
replaced
11941:4532c44bb62d | 11942:50a4e55aa278 |
---|