You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Small tweaks to sync up better with scanner2.py
This commit is contained in:
@@ -175,7 +175,9 @@ class Scanner3(Scanner):
|
|||||||
# and the value is the argument stack entries for that
|
# and the value is the argument stack entries for that
|
||||||
# nonterminal. The count is a little hoaky. It is mostly
|
# nonterminal. The count is a little hoaky. It is mostly
|
||||||
# not used, but sometimes it is.
|
# not used, but sometimes it is.
|
||||||
|
# "customize" is a dict whose keys are nonterminals
|
||||||
customize = {}
|
customize = {}
|
||||||
|
|
||||||
if self.is_pypy:
|
if self.is_pypy:
|
||||||
customize['PyPy'] = 0
|
customize['PyPy'] = 0
|
||||||
|
|
||||||
@@ -193,7 +195,9 @@ class Scanner3(Scanner):
|
|||||||
n = len(self.insts)
|
n = len(self.insts)
|
||||||
for i, inst in enumerate(self.insts):
|
for i, inst in enumerate(self.insts):
|
||||||
# We need to detect the difference between
|
# We need to detect the difference between
|
||||||
# "raise AssertionError" and "assert"
|
# raise AssertionError
|
||||||
|
# and
|
||||||
|
# assert ...
|
||||||
# If we have a JUMP_FORWARD after the
|
# If we have a JUMP_FORWARD after the
|
||||||
# RAISE_VARARGS then we have a "raise" statement
|
# RAISE_VARARGS then we have a "raise" statement
|
||||||
# else we have an "assert" statement.
|
# else we have an "assert" statement.
|
||||||
@@ -258,10 +262,11 @@ class Scanner3(Scanner):
|
|||||||
pattr = inst.argrepr
|
pattr = inst.argrepr
|
||||||
opname = inst.opname
|
opname = inst.opname
|
||||||
|
|
||||||
if opname in ['LOAD_CONST']:
|
if op in self.opc.CONST_OPS:
|
||||||
const = argval
|
const = argval
|
||||||
if iscode(const):
|
if iscode(const):
|
||||||
if const.co_name == '<lambda>':
|
if const.co_name == '<lambda>':
|
||||||
|
assert opname == 'LOAD_CONST'
|
||||||
opname = 'LOAD_LAMBDA'
|
opname = 'LOAD_LAMBDA'
|
||||||
elif const.co_name == '<genexpr>':
|
elif const.co_name == '<genexpr>':
|
||||||
opname = 'LOAD_GENEXPR'
|
opname = 'LOAD_GENEXPR'
|
||||||
|
Reference in New Issue
Block a user