You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 09:22:40 +08:00
Merge pull request #119 from rocky/scan-longconstant
Simplify access to L65536 ...
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 2015, 2016 by Rocky Bernstein
|
# Copyright (c) 2015-2017 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>
|
||||||
"""
|
"""
|
||||||
@@ -25,14 +25,14 @@ from __future__ import print_function
|
|||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from array import array
|
from array import array
|
||||||
|
|
||||||
from uncompyle6.scanner import op_has_argument
|
from uncompyle6.scanner import op_has_argument, L65536
|
||||||
from xdis.code import iscode
|
from xdis.code import iscode
|
||||||
|
|
||||||
import uncompyle6.scanner as scan
|
from uncompyle6.scanner import Scanner
|
||||||
|
|
||||||
class Scanner2(scan.Scanner):
|
class Scanner2(Scanner):
|
||||||
def __init__(self, version, show_asm=None, is_pypy=False):
|
def __init__(self, version, show_asm=None, is_pypy=False):
|
||||||
scan.Scanner.__init__(self, version, show_asm, is_pypy)
|
Scanner.__init__(self, version, show_asm, is_pypy)
|
||||||
self.pop_jump_if = frozenset([self.opc.PJIF, self.opc.PJIT])
|
self.pop_jump_if = frozenset([self.opc.PJIF, self.opc.PJIT])
|
||||||
self.jump_forward = frozenset([self.opc.JUMP_ABSOLUTE, self.opc.JUMP_FORWARD])
|
self.jump_forward = frozenset([self.opc.JUMP_ABSOLUTE, self.opc.JUMP_FORWARD])
|
||||||
# This is the 2.5+ default
|
# This is the 2.5+ default
|
||||||
@@ -186,7 +186,7 @@ class Scanner2(scan.Scanner):
|
|||||||
oparg = self.get_argument(offset) + extended_arg
|
oparg = self.get_argument(offset) + extended_arg
|
||||||
extended_arg = 0
|
extended_arg = 0
|
||||||
if op == self.opc.EXTENDED_ARG:
|
if op == self.opc.EXTENDED_ARG:
|
||||||
extended_arg = oparg * scan.L65536
|
extended_arg = oparg * L65536
|
||||||
continue
|
continue
|
||||||
if op in self.opc.hasconst:
|
if op in self.opc.hasconst:
|
||||||
const = co.co_consts[oparg]
|
const = co.co_consts[oparg]
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 2015, 2016 by Rocky Bernstein
|
# Copyright (c) 2015-2017 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>
|
||||||
"""
|
"""
|
||||||
@@ -15,6 +15,7 @@ if PYTHON3:
|
|||||||
intern = sys.intern
|
intern = sys.intern
|
||||||
|
|
||||||
import uncompyle6.scanners.scanner2 as scan
|
import uncompyle6.scanners.scanner2 as scan
|
||||||
|
from uncompyle6.scanner import L65536
|
||||||
|
|
||||||
# bytecode verification, verify(), uses JUMP_OPs from here
|
# bytecode verification, verify(), uses JUMP_OPs from here
|
||||||
from xdis.opcodes import opcode_26
|
from xdis.opcodes import opcode_26
|
||||||
@@ -178,7 +179,7 @@ class Scanner26(scan.Scanner2):
|
|||||||
oparg = self.get_argument(offset) + extended_arg
|
oparg = self.get_argument(offset) + extended_arg
|
||||||
extended_arg = 0
|
extended_arg = 0
|
||||||
if op == self.opc.EXTENDED_ARG:
|
if op == self.opc.EXTENDED_ARG:
|
||||||
extended_arg = oparg * scan.L65536
|
extended_arg = oparg * L65536
|
||||||
continue
|
continue
|
||||||
if op in self.opc.hasconst:
|
if op in self.opc.hasconst:
|
||||||
const = co.co_consts[oparg]
|
const = co.co_consts[oparg]
|
||||||
|
Reference in New Issue
Block a user