Skip to content

Commit b6aa587

Browse files
authored
Merge pull request #446 from rocky/do-not-quote-non-str-args
Use xdis pattr extraction for LOAD_NAME
2 parents 551e428 + ad00b9a commit b6aa587

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Bug was erroneously putting quotes around Exception on decompilatoin
2+
# RUNNABLE!
3+
4+
"""This program is self-checking!"""
5+
z = ["y", Exception]
6+
assert z[0] == "y"
7+
assert isinstance(z[1], Exception)

uncompyle6/scanners/scanner2.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2015-2022 by Rocky Bernstein
1+
# Copyright (c) 2015-2023 by Rocky Bernstein
22
# Copyright (c) 2005 by Dan Pascu <[email protected]>
33
# Copyright (c) 2000-2002 by hartmut Goebel <[email protected]>
44
#
@@ -38,7 +38,7 @@
3838
from copy import copy
3939

4040
from xdis import code2num, iscode, op_has_argument, instruction_size
41-
from xdis.bytecode import _get_const_info
41+
from xdis.bytecode import _get_const_info, _get_name_info
4242
from uncompyle6.scanner import Scanner, Token
4343

4444
from sys import intern
@@ -360,6 +360,7 @@ def ingest(self, co, classname=None, code_objects={}, show_asm=None):
360360
pattr = const
361361
pass
362362
elif op in self.opc.NAME_OPS:
363+
_, pattr = _get_name_info(oparg, names)
363364
pattr = names[oparg]
364365
elif op in self.opc.JREL_OPS:
365366
# use instead: hasattr(self, 'patch_continue'): ?

0 commit comments

Comments
 (0)