You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
Add a scanner next_offset() routine
Remove extended_arg_val() as that is now in xdis
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2016 by Rocky Bernstein
|
||||
# Copyright (c) 2016, 2018 by Rocky Bernstein
|
||||
# Copyright (c) 2005 by Dan Pascu <dan@windowmaker.org>
|
||||
# Copyright (c) 2000-2002 by hartmut Goebel <h.goebel@crazy-compilers.com>
|
||||
# Copyright (c) 1999 John Aycock
|
||||
@@ -16,6 +16,7 @@ import sys
|
||||
|
||||
from uncompyle6 import PYTHON3, IS_PYPY
|
||||
from uncompyle6.scanners.tok import Token
|
||||
import xdis
|
||||
from xdis.bytecode import op_size
|
||||
from xdis.magics import py_str2float, canonic_python_version
|
||||
from xdis.util import code2num
|
||||
@@ -105,14 +106,13 @@ class Scanner(object):
|
||||
target += pos + 3
|
||||
return target
|
||||
|
||||
# FIXME: the below can be removed after xdis version 3.6.1 has been released
|
||||
def extended_arg_val(self, val):
|
||||
return val << self.opc.EXTENDED_ARG_SHIFT
|
||||
|
||||
def get_argument(self, pos):
|
||||
arg = self.code[pos+1] + self.code[pos+2] * 256
|
||||
return arg
|
||||
|
||||
def next_offset(self, op, offset):
|
||||
return xdis.next_offset(op, self.opc, offset)
|
||||
|
||||
def print_bytecode(self):
|
||||
for i in self.op_range(0, len(self.code)):
|
||||
op = self.code[i]
|
||||
|
Reference in New Issue
Block a user