Small changes...

pysource.py: Bug fix for relative imports.

scanner2.py: Remove a debug expression
This commit is contained in:
rocky
2018-03-05 21:52:34 -05:00
parent cad1325a90
commit 5d24367ef6
4 changed files with 4 additions and 2 deletions

Binary file not shown.

View File

@@ -0,0 +1,2 @@
# Tests relative imports
from . import bogus

View File

@@ -301,7 +301,7 @@ class Scanner2(Scanner):
j = self.offset2inst_index[offset] j = self.offset2inst_index[offset]
target_index = self.offset2inst_index[target] target_index = self.offset2inst_index[target]
is_continue = (self.insts[target_index-1].opname == 'SETUP_LOOP' is_continue = (self.insts[target_index-1].opname == 'SETUP_LOOP'
and self.insts[j+1].opname == 'JUMP_FORWARD') and False and self.insts[j+1].opname == 'JUMP_FORWARD')
if is_continue: if is_continue:
op_name = 'CONTINUE' op_name = 'CONTINUE'
if (offset in self.stmts and if (offset in self.stmts and

View File

@@ -1024,7 +1024,7 @@ class SourceWalker(GenericASTTraversal, object):
def n_import_from(self, node): def n_import_from(self, node):
relative_path_index = 0 relative_path_index = 0
if self.version >= 2.5: if self.version >= 2.5:
if node[relative_path_index].attr > 0: if node[relative_path_index].pattr > 0:
node[2].pattr = ('.' * node[relative_path_index].pattr) + node[2].pattr node[2].pattr = ('.' * node[relative_path_index].pattr) + node[2].pattr
if self.version > 2.7: if self.version > 2.7:
if isinstance(node[1].pattr, tuple): if isinstance(node[1].pattr, tuple):