summaryrefslogtreecommitdiffstats
path: root/Lib/inspect.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2007-07-12 08:11:29 (GMT)
committerGeorg Brandl <georg@python.org>2007-07-12 08:11:29 (GMT)
commitbc5fbd9f8c1a271557846d7aa7a428ae25f901e8 (patch)
tree2655501a015fd64b138869568e40f4e79f74c970 /Lib/inspect.py
parentf91149e4a194621b08346ce3f110712a174e271c (diff)
downloadcpython-bc5fbd9f8c1a271557846d7aa7a428ae25f901e8.zip
cpython-bc5fbd9f8c1a271557846d7aa7a428ae25f901e8.tar.gz
cpython-bc5fbd9f8c1a271557846d7aa7a428ae25f901e8.tar.bz2
Patch #1739696: use code.co_code only if really necessary
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r--Lib/inspect.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py
index 986a415..000725a 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -679,7 +679,6 @@ def getargs(co):
if not iscode(co):
raise TypeError('arg is not a code object')
- code = co.co_code
nargs = co.co_argcount
names = co.co_varnames
args = list(names[:nargs])
@@ -689,12 +688,12 @@ def getargs(co):
for i in range(nargs):
if args[i][:1] in ('', '.'):
stack, remain, count = [], [], []
- while step < len(code):
- op = ord(code[step])
+ while step < len(co.co_code):
+ op = ord(co.co_code[step])
step = step + 1
if op >= dis.HAVE_ARGUMENT:
opname = dis.opname[op]
- value = ord(code[step]) + ord(code[step+1])*256
+ value = ord(co.co_code[step]) + ord(co.co_code[step+1])*256
step = step + 2
if opname in ('UNPACK_TUPLE', 'UNPACK_SEQUENCE'):
remain.append(value)