summaryrefslogtreecommitdiffstats
path: root/Lib/dis.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-10-19 22:06:24 (GMT)
committerGuido van Rossum <guido@python.org>2007-10-19 22:06:24 (GMT)
commit75a902db7859a4751743e98530c5d96a672641be (patch)
treea730c966dcfc993a800078004aae3a6094a75a6a /Lib/dis.py
parent21431e85d505b9698c085c25cbf1b2997a352b85 (diff)
downloadcpython-75a902db7859a4751743e98530c5d96a672641be.zip
cpython-75a902db7859a4751743e98530c5d96a672641be.tar.gz
cpython-75a902db7859a4751743e98530c5d96a672641be.tar.bz2
Patch 1280, by Alexandre Vassalotti.
Make PyString's indexing and iteration return integers. (I changed a few of Alexandre's decisions -- GvR.)
Diffstat (limited to 'Lib/dis.py')
-rw-r--r--Lib/dis.py19
1 files changed, 8 insertions, 11 deletions
diff --git a/Lib/dis.py b/Lib/dis.py
index 200dee2..4cf452a 100644
--- a/Lib/dis.py
+++ b/Lib/dis.py
@@ -117,8 +117,7 @@ def disassemble(co, lasti=-1):
extended_arg = 0
free = None
while i < n:
- c = code[i]
- op = ord(c)
+ op = code[i]
if i in linestarts:
if i > 0:
print()
@@ -134,7 +133,7 @@ def disassemble(co, lasti=-1):
print(opname[op].ljust(20), end=' ')
i = i+1
if op >= HAVE_ARGUMENT:
- oparg = ord(code[i]) + ord(code[i+1])*256 + extended_arg
+ oparg = code[i] + code[i+1]*256 + extended_arg
extended_arg = 0
i = i+2
if op == EXTENDED_ARG:
@@ -162,8 +161,7 @@ def disassemble_string(code, lasti=-1, varnames=None, names=None,
n = len(code)
i = 0
while i < n:
- c = code[i]
- op = ord(c)
+ op = code[i]
if i == lasti: print('-->', end=' ')
else: print(' ', end=' ')
if i in labels: print('>>', end=' ')
@@ -172,7 +170,7 @@ def disassemble_string(code, lasti=-1, varnames=None, names=None,
print(opname[op].ljust(15), end=' ')
i = i+1
if op >= HAVE_ARGUMENT:
- oparg = ord(code[i]) + ord(code[i+1])*256
+ oparg = code[i] + code[i+1]*256
i = i+2
print(repr(oparg).rjust(5), end=' ')
if op in hasconst:
@@ -208,11 +206,10 @@ def findlabels(code):
n = len(code)
i = 0
while i < n:
- c = code[i]
- op = ord(c)
+ op = code[i]
i = i+1
if op >= HAVE_ARGUMENT:
- oparg = ord(code[i]) + ord(code[i+1])*256
+ oparg = code[i] + code[i+1]*256
i = i+2
label = -1
if op in hasjrel:
@@ -230,8 +227,8 @@ def findlinestarts(code):
Generate pairs (offset, lineno) as described in Python/compile.c.
"""
- byte_increments = [ord(c) for c in code.co_lnotab[0::2]]
- line_increments = [ord(c) for c in code.co_lnotab[1::2]]
+ byte_increments = list(code.co_lnotab[0::2])
+ line_increments = list(code.co_lnotab[1::2])
lastlineno = None
lineno = code.co_firstlineno