You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Use xdis pattr extraction for LOAD_NAME
This commit is contained in:
7
test/simple_source/bug27+/01_argument_quoting.py
Normal file
7
test/simple_source/bug27+/01_argument_quoting.py
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# Bug was erroneously putting quotes around Exception on decompilatoin
|
||||||
|
# RUNNABLE!
|
||||||
|
|
||||||
|
"""This program is self-checking!"""
|
||||||
|
z = ["y", Exception]
|
||||||
|
assert z[0] == "y"
|
||||||
|
assert isinstance(z[1], Exception)
|
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 2015-2022 by Rocky Bernstein
|
# Copyright (c) 2015-2023 by Rocky Bernstein
|
||||||
# Copyright (c) 2005 by Dan Pascu <dan@windowmaker.org>
|
# Copyright (c) 2005 by Dan Pascu <dan@windowmaker.org>
|
||||||
# Copyright (c) 2000-2002 by hartmut Goebel <h.goebel@crazy-compilers.com>
|
# 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 copy import copy
|
||||||
|
|
||||||
from xdis import code2num, iscode, op_has_argument, instruction_size
|
from xdis import code2num, iscode, op_has_argument, instruction_size
|
||||||
from xdis.bytecode import _get_const_info
|
from xdis.bytecode import _get_const_info, _get_name_info
|
||||||
from uncompyle6.scanner import Scanner, Token
|
from uncompyle6.scanner import Scanner, Token
|
||||||
|
|
||||||
from sys import intern
|
from sys import intern
|
||||||
@@ -360,6 +360,7 @@ class Scanner2(Scanner):
|
|||||||
pattr = const
|
pattr = const
|
||||||
pass
|
pass
|
||||||
elif op in self.opc.NAME_OPS:
|
elif op in self.opc.NAME_OPS:
|
||||||
|
_, pattr = _get_name_info(oparg, names)
|
||||||
pattr = names[oparg]
|
pattr = names[oparg]
|
||||||
elif op in self.opc.JREL_OPS:
|
elif op in self.opc.JREL_OPS:
|
||||||
# use instead: hasattr(self, 'patch_continue'): ?
|
# use instead: hasattr(self, 'patch_continue'): ?
|
||||||
|
Reference in New Issue
Block a user