Correct a couple of bugs...

We weren't distinguising relative imports from absolute imports.
Fixes #444

Picking out docstring was broken too.
This commit is contained in:
rocky
2023-04-17 16:35:27 -04:00
parent b6aa58790f
commit 7ad0c37c62
4 changed files with 22 additions and 24 deletions

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2015-2023 by Rocky Bernstein
# Copyright (c) 2015-2022 by Rocky Bernstein
# Copyright (c) 2005 by Dan Pascu <dan@windowmaker.org>
# Copyright (c) 2000-2002 by hartmut Goebel <h.goebel@crazy-compilers.com>
#
@@ -38,7 +38,7 @@ from __future__ import print_function
from copy import copy
from xdis import code2num, iscode, op_has_argument, instruction_size
from xdis.bytecode import _get_const_info, _get_name_info
from xdis.bytecode import _get_const_info
from uncompyle6.scanner import Scanner, Token
from sys import intern
@@ -320,7 +320,9 @@ class Scanner2(Scanner):
"BUILD_SET",
):
t = Token(
op_name, oparg, pattr, offset, self.linestarts.get(offset, None), op, has_arg, self.opc
op_name, oparg, pattr, offset,
self.linestarts.get(offset, None),
op, has_arg, self.opc
)
collection_type = op_name.split("_")[1]
next_tokens = self.bound_collection_from_tokens(
@@ -360,7 +362,6 @@ class Scanner2(Scanner):
pattr = const
pass
elif op in self.opc.NAME_OPS:
_, pattr = _get_name_info(oparg, names)
pattr = names[oparg]
elif op in self.opc.JREL_OPS:
# use instead: hasattr(self, 'patch_continue'): ?