You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Small changes...
pysource.py: Bug fix for relative imports. scanner2.py: Remove a debug expression
This commit is contained in:
BIN
test/bytecode_2.7/01_rel_import.pyc
Normal file
BIN
test/bytecode_2.7/01_rel_import.pyc
Normal file
Binary file not shown.
2
test/simple_source/stmts/01_rel_import.py
Normal file
2
test/simple_source/stmts/01_rel_import.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# Tests relative imports
|
||||||
|
from . import bogus
|
@@ -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
|
||||||
|
@@ -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):
|
||||||
|
Reference in New Issue
Block a user