Skip to content
This repository was archived by the owner on Mar 2, 2022. It is now read-only.

Commit b3341b3

Browse files
committed
Remove more dead code and Python 2.x cruft
Summary: Cleaning up more random cruft - there's some simple dead code, and some support for Python 2 that we don't need Test Plan: ./python -m test.test_compiler
1 parent 756ee68 commit b3341b3

File tree

1 file changed

+1
-23
lines changed

1 file changed

+1
-23
lines changed

compiler/pyassem.py

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,11 @@
99
from compiler import misc
1010
from compiler.consts \
1111
import CO_OPTIMIZED, CO_NEWLOCALS, CO_VARARGS, CO_VARKEYWORDS
12+
from types import CodeType
1213
from .peephole import Optimizer
1314

1415
EXTENDED_ARG = dis.opname.index('EXTENDED_ARG')
1516

16-
VERSION = sys.version_info[0]
17-
if VERSION < 3:
18-
def CodeType(*args):
19-
args = list(args)
20-
del args[1]
21-
return types.CodeType(*args)
22-
org_bytes = bytes
23-
def bytes(l):
24-
assert isinstance(l, list)
25-
return org_bytes(bytearray(l))
26-
else:
27-
CodeType = types.CodeType
28-
long = int
29-
3017

3118
def instrsize(oparg):
3219
if oparg <= 0xff:
@@ -661,15 +648,6 @@ def getConsts(self):
661648
# Just return the constant value, removing the type portion.
662649
return tuple(const[1] for const in self.consts)
663650

664-
def isJump(opname):
665-
if opname[:4] == 'JUMP':
666-
return 1
667-
668-
669-
def twobyte(val):
670-
"""Convert an int argument into high and low bytes"""
671-
assert isinstance(val, (int, long))
672-
return divmod(val, 256)
673651

674652
class LineAddrTable:
675653
"""lnotab

0 commit comments

Comments
 (0)