[Python-Dev] [Python-checkins] cpython: Issue #26647: Python interpreter now uses 16-bit wordcode instead of bytecode. (original) (raw)

Brett Cannon brett at snarky.ca
Tue May 24 12:57:18 EDT 2016


This probably deserves a "What's New" entry since it does break bytecode-inspecting code.

On Mon, 23 May 2016 at 23:15 serhiy.storchaka <python-checkins at python.org> wrote:

https://hg.python.org/cpython/rev/3a57eafd8401 changeset: 101486:3a57eafd8401 user: Serhiy Storchaka <storchaka at gmail.com> date: Tue May 24 09:15:14 2016 +0300 summary: Issue #26647: Python interpreter now uses 16-bit wordcode instead of bytecode. Patch by Demur Rumed.

files: Doc/library/dis.rst | 9 +- Lib/ctypes/test/testvalues.py | 6 +- Lib/dis.py | 35 +- Lib/importlib/bootstrapexternal.py | 3 +- Lib/test/testdis.py | 512 +- Misc/NEWS | 3 + Objects/frameobject.c | 12 +- Objects/genobject.c | 4 +- PC/launcher.c | 2 +- PCbuild/pythoncore.vcxproj | 1 + PCbuild/pythoncore.vcxproj.filters | 3 + Python/ceval.c | 133 +- Python/compile.c | 81 +- Python/frozen.c | 20 +- Python/importlib.h | 3719 +++++----- Python/importlibexternal.h | 4612 ++++++------- Python/peephole.c | 578 +- Python/wordcodehelpers.h | 38 + 18 files changed, 4748 insertions(+), 5023 deletions(-)

diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -31,9 +31,9 @@ >>> dis.dis(myfunc) 2 0 LOADGLOBAL 0 (len) - 3 LOADFAST 0 (alist) - 6 CALLFUNCTION 1 - 9 RETURNVALUE + 2 LOADFAST 0 (alist) + 4 CALLFUNCTION 1 + 6 RETURNVALUE (The "2" is a line number). @@ -682,8 +682,7 @@ .. XXX explain the WHY stuff! -All of the following opcodes expect arguments. An argument is two bytes, with -the more significant byte last. +All of the following opcodes use their arguments. .. opcode:: STORENAME (namei) diff --git a/Lib/ctypes/test/testvalues.py b/Lib/ctypes/test/testvalues.py --- a/Lib/ctypes/test/testvalues.py +++ b/Lib/ctypes/test/testvalues.py @@ -79,9 +79,9 @@ continue items.append((entry.name.decode("ascii"), entry.size)) - expected = [("hello", 161), - ("phello", -161), - ("phello.spam", 161), + expected = [("hello", 139), + ("phello", -139), + ("phello.spam", 139), ] self.assertEqual(items, expected, "PyImportFrozenModules example " "in Doc/library/ctypes.rst may be out of date") diff --git a/Lib/dis.py b/Lib/dis.py --- a/Lib/dis.py +++ b/Lib/dis.py @@ -285,7 +285,6 @@ """ labels = findlabels(code) startsline = None - free = None for offset, op, arg in unpackopargs(code): if linestarts is not None: startsline = linestarts.get(offset, None) @@ -296,7 +295,7 @@ argrepr = '' if arg is not None: # Set argval to the dereferenced value of the argument when - # availabe, and argrepr to the string representation of argval. + # available, and argrepr to the string representation of argval. # disassemblebytes needs the string repr of the # raw name index for LOADGLOBAL, LOADCONST, etc. argval = arg @@ -305,7 +304,7 @@ elif op in hasname: argval, argrepr = getnameinfo(arg, names) elif op in hasjrel: - argval = offset + 3 + arg + argval = offset + 2 + arg argrepr = "to " + repr(argval) elif op in haslocal: argval, argrepr = getnameinfo(arg, varnames) @@ -352,23 +351,15 @@ disco = disassemble # XXX For backwards compatibility def unpackopargs(code): - # enumerate() is not an option, since we sometimes process - # multiple elements on a single pass through the loop extendedarg = 0 - n = len(code) - i = 0 - while i < n:_ _+ for i in range(0, len(code), 2):_ _op = code[i]_ _- offset = i_ _- i = i+1_ _- arg = None_ _if op >= HAVEARGUMENT: - arg = code[i] + code[i+1]*256 + extendedarg - extendedarg = 0 - i = i+2 - if op == EXTENDEDARG: - extendedarg = arg*65536 - yield (offset, op, arg) + arg = code[i+1] | extendedarg + extendedarg = (arg << 8) if op == EXTENDEDARG else 0_ _+ else:_ _+ arg = None_ _+ yield (i, op, arg)_ _def findlabels(code):_ _"""Detect all offsets in a byte code which are jump targets._ _@@ -379,14 +370,14 @@_ _labels = []_ _for offset, op, arg in unpackopargs(code):_ _if arg is not None:_ _- label = -1_ _if op in hasjrel:_ _- label = offset + 3 + arg_ _+ label = offset + 2 + arg_ _elif op in hasjabs:_ _label = arg_ _- if label >= 0: - if label not in labels: - labels.append(label) + else: + continue + if label not in labels: + labels.append(label) return labels def findlinestarts(code): diff --git a/Lib/importlib/bootstrapexternal.py b/Lib/importlib/bootstrapexternal.py --- a/Lib/importlib/bootstrapexternal.py +++ b/Lib/importlib/bootstrapexternal.py @@ -225,6 +225,7 @@ # Python 3.5b2 3350 (add GETYIELDFROMITER opcode #24400) # Python 3.6a0 3360 (add FORMATVALUE opcode #25483 # Python 3.6a0 3361 (lineno delta of code.colnotab becomes signed) +# Python 3.6a0 3370 (16 bit wordcode) # # MAGIC must change whenever the bytecode emitted by the compiler may no # longer be understood by older implementations of the eval loop (usually @@ -233,7 +234,7 @@ # Whenever MAGICNUMBER is changed, the ranges in the magicvalues array # in PC/launcher.c must also be updated. -MAGICNUMBER = (3361).tobytes(2, 'little') + b'\r\n' +MAGICNUMBER = (3370).tobytes(2, 'little') + b'\r\n' RAWMAGICNUMBER = int.frombytes(MAGICNUMBER, 'little') # For import.c PYCACHE = 'pycache' diff --git a/Lib/test/testdis.py b/Lib/test/testdis.py --- a/Lib/test/testdis.py +++ b/Lib/test/testdis.py @@ -40,41 +40,41 @@ _discinstancemethod = """_ %3d 0 LOADFAST 1 (x) - 3 LOADCONST 1 (1) - 6 COMPAREOP 2 (==) - 9 LOADFAST 0 (self) - 12 STOREATTR 0 (x) - 15 LOADCONST 0 (None) - 18 RETURNVALUE + 2 LOADCONST 1 (1) + 4 COMPAREOP 2 (==) + 6 LOADFAST 0 (self) + 8 STOREATTR 0 (x) + 10 LOADCONST 0 (None) + 12 RETURNVALUE """ % (C.init.code.cofirstlineno + 1,) _discinstancemethodbytes = """_ 0 LOADFAST 1 (1) - 3 LOADCONST 1 (1) - 6 COMPAREOP 2 (==) - 9 LOADFAST 0 (0) - 12 STOREATTR 0 (0) - 15 LOADCONST 0 (0) - 18 RETURNVALUE + 2 LOADCONST 1 (1) + 4 COMPAREOP 2 (==) + 6 LOADFAST 0 (0) + 8 STOREATTR 0 (0) + 10 LOADCONST 0 (0) + 12 RETURNVALUE """ _discclassmethod = """_ %3d 0 LOADFAST 1 (x) - 3 LOADCONST 1 (1) - 6 COMPAREOP 2 (==) - 9 LOADFAST 0 (cls) - 12 STOREATTR 0 (x) - 15 LOADCONST 0 (None) - 18 RETURNVALUE + 2 LOADCONST 1 (1) + 4 COMPAREOP 2 (==) + 6 LOADFAST 0 (cls) + 8 STOREATTR 0 (x) + 10 LOADCONST 0 (None) + 12 RETURNVALUE """ % (C.cm.code.cofirstlineno + 2,) _discstaticmethod = """_ %3d 0 LOADFAST 0 (x) - 3 LOADCONST 1 (1) - 6 COMPAREOP 2 (==) - 9 STOREFAST 0 (x) - 12 LOADCONST 0 (None) - 15 RETURNVALUE + 2 LOADCONST 1 (1) + 4 COMPAREOP 2 (==) + 6 STOREFAST 0 (x) + 8 LOADCONST 0 (None) + 10 RETURNVALUE """ % (C.sm.code.cofirstlineno + 2,) # Class disassembling info has an extra newline at end. @@ -95,23 +95,23 @@ _disf = """_ %3d 0 LOADGLOBAL 0 (print) - 3 LOADFAST 0 (a) - 6 CALLFUNCTION 1 (1 positional, 0 keyword pair) - 9 POPTOP + 2 LOADFAST 0 (a) + 4 CALLFUNCTION 1 (1 positional, 0 keyword pair) + 6 POPTOP -%3d 10 LOADCONST 1 (1) - 13 RETURNVALUE +%3d 8 LOADCONST 1 (1) + 10 RETURNVALUE """ % (f.code.cofirstlineno + 1, f.code.cofirstlineno + 2) _disfcocode = """_ 0 LOADGLOBAL 0 (0) - 3 LOADFAST 0 (0) - 6 CALLFUNCTION 1 (1 positional, 0 keyword pair) - 9 POPTOP - 10 LOADCONST 1 (1) - 13 RETURNVALUE + 2 LOADFAST 0 (0) + 4 CALLFUNCTION 1 (1 positional, 0 keyword pair) + 6 POPTOP + 8 LOADCONST 1 (1) + 10 RETURNVALUE """ @@ -121,20 +121,20 @@ pass _disbug708901 = """_ -%3d 0 SETUPLOOP 23 (to 26) - 3 LOADGLOBAL 0 (range) - 6 LOADCONST 1 (1) +%3d 0 SETUPLOOP 18 (to 20) + 2 LOADGLOBAL 0 (range) + 4 LOADCONST 1 (1) -%3d 9 LOADCONST 2 (10) - 12 CALLFUNCTION 2 (2 positional, 0 keyword pair) - 15 GETITER - >> 16 FORITER 6 (to 25) - 19 STOREFAST 0 (res) +%3d 6 LOADCONST 2 (10) + 8 CALLFUNCTION 2 (2 positional, 0 keyword pair) + 10 GETITER + >> 12 FORITER 4 (to 18) + 14 STOREFAST 0 (res) -%3d 22 JUMPABSOLUTE 16 - >> 25 POPBLOCK - >> 26 LOADCONST 0 (None) - 29 RETURNVALUE +%3d 16 JUMPABSOLUTE 12 + >> 18 POPBLOCK + >> 20 LOADCONST 0 (None) + 22 RETURNVALUE """ % (bug708901.code.cofirstlineno + 1, bug708901.code.cofirstlineno + 2, bug708901.code.cofirstlineno + 3) @@ -147,22 +147,22 @@ _disbug1333982 = """_ %3d 0 LOADCONST 1 (0) - 3 POPJUMPIFTRUE 35 - 6 LOADGLOBAL 0 (AssertionError) - 9 LOADCONST 2 (<code object at 0x..., file "%s", line %d>) - 12 LOADCONST 3 ('bug1333982..') - 15 MAKEFUNCTION 0 - 18 LOADFAST 0 (x) - 21 GETITER + 2 POPJUMPIFTRUE 26 + 4 LOADGLOBAL 0 (AssertionError) + 6 LOADCONST 2 (<code object at 0x..., file "%s", line %d>) + 8 LOADCONST 3 ('bug1333982..') + 10 MAKEFUNCTION 0 + 12 LOADFAST 0 (x) + 14 GETITER + 16 CALLFUNCTION 1 (1 positional, 0 keyword pair) + +%3d 18 LOADCONST 4 (1) + 20 BINARYADD 22 CALLFUNCTION 1 (1 positional, 0 keyword pair) + 24 RAISEVARARGS 1 -%3d 25 LOADCONST 4 (1) - 28 BINARYADD - 29 CALLFUNCTION 1 (1 positional, 0 keyword pair) - 32 RAISEVARARGS 1 - -%3d >> 35 LOADCONST 0 (None) - 38 RETURNVALUE +%3d >> 26 LOADCONST 0 (None) + 28 RETURNVALUE """ % (bug1333982.code.cofirstlineno + 1, file, bug1333982.code.cofirstlineno + 1, @@ -171,19 +171,19 @@ _BIGLINENOFORMAT = """_ %3d 0 LOADGLOBAL 0 (spam) - 3 POPTOP + 2 POPTOP 4 LOADCONST 0 (None) - 7 RETURNVALUE + 6 RETURNVALUE """ _dismoduleexpectedresults = """_ Disassembly of f: 4 0 LOADCONST 0 (None) - 3 RETURNVALUE + 2 RETURNVALUE Disassembly of g: 5 0 LOADCONST 0 (None) - 3 RETURNVALUE + 2 RETURNVALUE """ @@ -191,20 +191,20 @@ _disexprstr = """_ 1 0 LOADNAME 0 (x) - 3 LOADCONST 0 (1) - 6 BINARYADD - 7 RETURNVALUE + 2 LOADCONST 0 (1) + 4 BINARYADD + 6 RETURNVALUE """ simplestmtstr = "x = x + 1" _dissimplestmtstr = """_ 1 0 LOADNAME 0 (x) - 3 LOADCONST 0 (1) - 6 BINARYADD - 7 STORENAME 0 (x) - 10 LOADCONST 1 (None) - 13 RETURNVALUE + 2 LOADCONST 0 (1) + 4 BINARYADD + 6 STORENAME 0 (x) + 8 LOADCONST 1 (None) + 10 RETURNVALUE """ _compoundstmtstr = """_ @@ -215,54 +215,54 @@ _discompoundstmtstr = """_ 1 0 LOADCONST 0 (0) - 3 STORENAME 0 (x) + 2 STORENAME 0 (x) - 2 6 SETUPLOOP 14 (to 23) + 2 4 SETUPLOOP 12 (to 18) - 3 >> 9 LOADNAME 0 (x) - 12 LOADCONST 1 (1) - 15 INPLACEADD - 16 STORENAME 0 (x) - 19 JUMPABSOLUTE 9 - 22 POPBLOCK - >> 23 LOADCONST 2 (None) - 26 RETURNVALUE + 3 >> 6 LOADNAME 0 (x) + 8 LOADCONST 1 (1) + 10 INPLACEADD + 12 STORENAME 0 (x) + 14 JUMPABSOLUTE 6 + 16 POPBLOCK + >> 18 LOADCONST 2 (None) + 20 RETURNVALUE """ _distraceback = """_ -%3d 0 SETUPEXCEPT 12 (to 15) +%3d 0 SETUPEXCEPT 12 (to 14) -%3d 3 LOADCONST 1 (1) - 6 LOADCONST 2 (0) - --> 9 BINARYTRUEDIVIDE - 10 POPTOP - 11 POPBLOCK - 12 JUMPFORWARD 46 (to 61) +%3d 2 LOADCONST 1 (1) + 4 LOADCONST 2 (0) + --> 6 BINARYTRUEDIVIDE + 8 POPTOP + 10 POPBLOCK + 12 JUMPFORWARD 40 (to 54) -%3d >> 15 DUPTOP +%3d >> 14 DUPTOP 16 LOADGLOBAL 0 (Exception) - 19 COMPAREOP 10 (exception match) - 22 POPJUMPIFFALSE 60 - 25 POPTOP - 26 STOREFAST 0 (e) - 29 POPTOP - 30 SETUPFINALLY 14 (to 47) + 18 COMPAREOP 10 (exception match) + 20 POPJUMPIFFALSE 52 + 22 POPTOP + 24 STOREFAST 0 (e) + 26 POPTOP + 28 SETUPFINALLY 12 (to 42) -%3d 33 LOADFAST 0 (e) - 36 LOADATTR 1 (traceback) - 39 STOREFAST 1 (tb) - 42 POPBLOCK - 43 POPEXCEPT - 44 LOADCONST 0 (None) - >> 47 LOADCONST 0 (None) - 50 STOREFAST 0 (e) - 53 DELETEFAST 0 (e) - 56 ENDFINALLY - 57 JUMPFORWARD 1 (to 61) - >> 60 ENDFINALLY +%3d 30 LOADFAST 0 (e) + 32 LOADATTR 1 (traceback) + 34 STOREFAST 1 (tb) + 36 POPBLOCK + 38 POPEXCEPT + 40 LOADCONST 0 (None) + >> 42 LOADCONST 0 (None) + 44 STOREFAST 0 (e) + 46 DELETEFAST 0 (e) + 48 ENDFINALLY + 50 JUMPFORWARD 2 (to 54) + >> 52 ENDFINALLY -%3d >> 61 LOADFAST 1 (tb) - 64 RETURNVALUE +%3d >> 54 LOADFAST 1 (tb) + 56 RETURNVALUE """ % (TRACEBACKCODE.cofirstlineno + 1, TRACEBACKCODE.cofirstlineno + 2, TRACEBACKCODE.cofirstlineno + 3, @@ -650,170 +650,170 @@ Instruction = dis.Instruction expectedopinfoouter = [ Instruction(opname='LOADCONST', opcode=100, arg=1, argval=3, argrepr='3', offset=0, startsline=2, isjumptarget=False), - Instruction(opname='LOADCONST', opcode=100, arg=2, argval=4, argrepr='4', offset=3, startsline=None, isjumptarget=False), - Instruction(opname='LOADCLOSURE', opcode=135, arg=0, argval='a', argrepr='a', offset=6, startsline=None, isjumptarget=False), - Instruction(opname='LOADCLOSURE', opcode=135, arg=1, argval='b', argrepr='b', offset=9, startsline=None, isjumptarget=False), - Instruction(opname='BUILDTUPLE', opcode=102, arg=2, argval=2, argrepr='', offset=12, startsline=None, isjumptarget=False), - Instruction(opname='LOADCONST', opcode=100, arg=3, argval=codeobjectf, argrepr=repr(codeobjectf), offset=15, startsline=None, isjumptarget=False), - Instruction(opname='LOADCONST', opcode=100, arg=4, argval='outer..f', argrepr="'outer..f'", offset=18, startsline=None, isjumptarget=False), - Instruction(opname='MAKECLOSURE', opcode=134, arg=2, argval=2, argrepr='', offset=21, startsline=None, isjumptarget=False), - Instruction(opname='STOREFAST', opcode=125, arg=2, argval='f', argrepr='f', offset=24, startsline=None, isjumptarget=False), - Instruction(opname='LOADGLOBAL', opcode=116, arg=0, argval='print', argrepr='print', offset=27, startsline=7, isjumptarget=False), - Instruction(opname='LOADDEREF', opcode=136, arg=0, argval='a', argrepr='a', offset=30, startsline=None, isjumptarget=False), - Instruction(opname='LOADDEREF', opcode=136, arg=1, argval='b', argrepr='b', offset=33, startsline=None, isjumptarget=False), - Instruction(opname='LOADCONST', opcode=100, arg=5, argval='', argrepr="''", offset=36, startsline=None, isjumptarget=False), - Instruction(opname='LOADCONST', opcode=100, arg=6, argval=1, argrepr='1', offset=39, startsline=None, isjumptarget=False), - Instruction(opname='BUILDLIST', opcode=103, arg=0, argval=0, argrepr='', offset=42, startsline=None, isjumptarget=False), - Instruction(opname='BUILDMAP', opcode=105, arg=0, argval=0, argrepr='', offset=45, startsline=None, isjumptarget=False), - Instruction(opname='LOADCONST', opcode=100, arg=7, argval='Hello world!', argrepr="'Hello world!'", offset=48, startsline=None, isjumptarget=False), - Instruction(opname='CALLFUNCTION', opcode=131, arg=7, argval=7, argrepr='7 positional, 0 keyword pair', offset=51, startsline=None, isjumptarget=False), - Instruction(opname='POPTOP', opcode=1, arg=None, argval=None, argrepr='', offset=54, startsline=None, isjumptarget=False), - Instruction(opname='LOADFAST', opcode=124, arg=2, argval='f', argrepr='f', offset=55, startsline=8, isjumptarget=False), - Instruction(opname='RETURNVALUE', opcode=83, arg=None, argval=None, argrepr='', offset=58, startsline=None, isjumptarget=False), + Instruction(opname='LOADCONST', opcode=100, arg=2, argval=4, argrepr='4', offset=2, startsline=None, isjumptarget=False), + Instruction(opname='LOADCLOSURE', opcode=135, arg=0, argval='a', argrepr='a', offset=4, startsline=None, isjumptarget=False), + Instruction(opname='LOADCLOSURE', opcode=135, arg=1, argval='b', argrepr='b', offset=6, startsline=None, isjumptarget=False), + Instruction(opname='BUILDTUPLE', opcode=102, arg=2, argval=2, argrepr='', offset=8, startsline=None, isjumptarget=False), + Instruction(opname='LOADCONST', opcode=100, arg=3, argval=codeobjectf, argrepr=repr(codeobjectf), offset=10, startsline=None, isjumptarget=False), + Instruction(opname='LOADCONST', opcode=100, arg=4, argval='outer..f', argrepr="'outer..f'", offset=12, startsline=None, isjumptarget=False), + Instruction(opname='MAKECLOSURE', opcode=134, arg=2, argval=2, argrepr='', offset=14, startsline=None, isjumptarget=False), + Instruction(opname='STOREFAST', opcode=125, arg=2, argval='f', argrepr='f', offset=16, startsline=None, isjumptarget=False), + Instruction(opname='LOADGLOBAL', opcode=116, arg=0, argval='print', argrepr='print', offset=18, startsline=7, isjumptarget=False), + Instruction(opname='LOADDEREF', opcode=136, arg=0, argval='a', argrepr='a', offset=20, startsline=None, isjumptarget=False), + Instruction(opname='LOADDEREF', opcode=136, arg=1, argval='b', argrepr='b', offset=22, startsline=None, isjumptarget=False), + Instruction(opname='LOADCONST', opcode=100, arg=5, argval='', argrepr="''", offset=24, startsline=None, isjumptarget=False), + Instruction(opname='LOADCONST', opcode=100, arg=6, argval=1, argrepr='1', offset=26, startsline=None, isjumptarget=False), + Instruction(opname='BUILDLIST', opcode=103, arg=0, argval=0, argrepr='', offset=28, startsline=None, isjumptarget=False), + Instruction(opname='BUILDMAP', opcode=105, arg=0, argval=0, argrepr='', offset=30, startsline=None, isjumptarget=False), + Instruction(opname='LOADCONST', opcode=100, arg=7, argval='Hello world!', argrepr="'Hello world!'", offset=32, startsline=None, isjumptarget=False), + Instruction(opname='CALLFUNCTION', opcode=131, arg=7, argval=7, argrepr='7 positional, 0 keyword pair', offset=34, startsline=None, isjumptarget=False), + Instruction(opname='POPTOP', opcode=1, arg=None, argval=None, argrepr='', offset=36, startsline=None, isjumptarget=False), + Instruction(opname='LOADFAST', opcode=124, arg=2, argval='f', argrepr='f', offset=38, startsline=8, isjumptarget=False), + Instruction(opname='RETURNVALUE', opcode=83, arg=None, argval=None, argrepr='', offset=40, startsline=None, isjumptarget=False), ] expectedopinfof = [ Instruction(opname='LOADCONST', opcode=100, arg=1, argval=5, argrepr='5', offset=0, startsline=3, isjumptarget=False), - Instruction(opname='LOADCONST', opcode=100, arg=2, argval=6, argrepr='6', offset=3, startsline=None, isjumptarget=False), - Instruction(opname='LOADCLOSURE', opcode=135, arg=2, argval='a', argrepr='a', offset=6, startsline=None, isjumptarget=False), - Instruction(opname='LOADCLOSURE', opcode=135, arg=3, argval='b', argrepr='b', offset=9, startsline=None, isjumptarget=False), - Instruction(opname='LOADCLOSURE', opcode=135, arg=0, argval='c', argrepr='c', offset=12, startsline=None, isjumptarget=False), - Instruction(opname='LOADCLOSURE', opcode=135, arg=1, argval='d', argrepr='d', offset=15, startsline=None, isjumptarget=False), - Instruction(opname='BUILDTUPLE', opcode=102, arg=4, argval=4, argrepr='', offset=18, startsline=None, isjumptarget=False), - Instruction(opname='LOADCONST', opcode=100, arg=3, argval=codeobjectinner, argrepr=repr(codeobjectinner), offset=21, startsline=None, isjumptarget=False), - Instruction(opname='LOADCONST', opcode=100, arg=4, argval='outer..f..inner', argrepr="'outer..f..inner'", offset=24, startsline=None, isjumptarget=False), - Instruction(opname='MAKECLOSURE', opcode=134, arg=2, argval=2, argrepr='', offset=27, startsline=None, isjumptarget=False), - Instruction(opname='STOREFAST', opcode=125, arg=2, argval='inner', argrepr='inner', offset=30, startsline=None, isjumptarget=False), - Instruction(opname='LOADGLOBAL', opcode=116, arg=0, argval='print', argrepr='print', offset=33, startsline=5, isjumptarget=False), - Instruction(opname='LOADDEREF', opcode=136, arg=2, argval='a', argrepr='a', offset=36, startsline=None, isjumptarget=False), - Instruction(opname='LOADDEREF', opcode=136, arg=3, argval='b', argrepr='b', offset=39, startsline=None, isjumptarget=False), - Instruction(opname='LOADDEREF', opcode=136, arg=0, argval='c', argrepr='c', offset=42, startsline=None, isjumptarget=False), - Instruction(opname='LOADDEREF', opcode=136, arg=1, argval='d', argrepr='d', offset=45, startsline=None, isjumptarget=False), - Instruction(opname='CALLFUNCTION', opcode=131, arg=4, argval=4, argrepr='4 positional, 0 keyword pair', offset=48, startsline=None, isjumptarget=False), - Instruction(opname='POPTOP', opcode=1, arg=None, argval=None, argrepr='', offset=51, startsline=None, isjumptarget=False), - Instruction(opname='LOADFAST', opcode=124, arg=2, argval='inner', argrepr='inner', offset=52, startsline=6, isjumptarget=False), - Instruction(opname='RETURNVALUE', opcode=83, arg=None, argval=None, argrepr='', offset=55, startsline=None, isjumptarget=False), + Instruction(opname='LOADCONST', opcode=100, arg=2, argval=6, argrepr='6', offset=2, startsline=None, isjumptarget=False), + Instruction(opname='LOADCLOSURE', opcode=135, arg=2, argval='a', argrepr='a', offset=4, startsline=None, isjumptarget=False), + Instruction(opname='LOADCLOSURE', opcode=135, arg=3, argval='b', argrepr='b', offset=6, startsline=None, isjumptarget=False), + Instruction(opname='LOADCLOSURE', opcode=135, arg=0, argval='c', argrepr='c', offset=8, startsline=None, isjumptarget=False), + Instruction(opname='LOADCLOSURE', opcode=135, arg=1, argval='d', argrepr='d', offset=10, startsline=None, isjumptarget=False), + Instruction(opname='BUILDTUPLE', opcode=102, arg=4, argval=4, argrepr='', offset=12, startsline=None, isjumptarget=False), + Instruction(opname='LOADCONST', opcode=100, arg=3, argval=codeobjectinner, argrepr=repr(codeobjectinner), offset=14, startsline=None, isjumptarget=False), + Instruction(opname='LOADCONST', opcode=100, arg=4, argval='outer..f..inner', argrepr="'outer..f..inner'", offset=16, startsline=None, isjumptarget=False), + Instruction(opname='MAKECLOSURE', opcode=134, arg=2, argval=2, argrepr='', offset=18, startsline=None, isjumptarget=False), + Instruction(opname='STOREFAST', opcode=125, arg=2, argval='inner', argrepr='inner', offset=20, startsline=None, isjumptarget=False), + Instruction(opname='LOADGLOBAL', opcode=116, arg=0, argval='print', argrepr='print', offset=22, startsline=5, isjumptarget=False), + Instruction(opname='LOADDEREF', opcode=136, arg=2, argval='a', argrepr='a', offset=24, startsline=None, isjumptarget=False), + Instruction(opname='LOADDEREF', opcode=136, arg=3, argval='b', argrepr='b', offset=26, startsline=None, isjumptarget=False), + Instruction(opname='LOADDEREF', opcode=136, arg=0, argval='c', argrepr='c', offset=28, startsline=None, isjumptarget=False), + Instruction(opname='LOADDEREF', opcode=136, arg=1, argval='d', argrepr='d', offset=30, startsline=None, isjumptarget=False), + Instruction(opname='CALLFUNCTION', opcode=131, arg=4, argval=4, argrepr='4 positional, 0 keyword pair', offset=32, startsline=None, isjumptarget=False), + Instruction(opname='POPTOP', opcode=1, arg=None, argval=None, argrepr='', offset=34, startsline=None, isjumptarget=False), + Instruction(opname='LOADFAST', opcode=124, arg=2, argval='inner', argrepr='inner', offset=36, startsline=6, isjumptarget=False), + Instruction(opname='RETURNVALUE', opcode=83, arg=None, argval=None, argrepr='', offset=38, startsline=None, isjumptarget=False), ] expectedopinfoinner = [ Instruction(opname='LOADGLOBAL', opcode=116, arg=0, argval='print', argrepr='print', offset=0, startsline=4, isjumptarget=False), - Instruction(opname='LOADDEREF', opcode=136, arg=0, argval='a', argrepr='a', offset=3, startsline=None, isjumptarget=False), - Instruction(opname='LOADDEREF', opcode=136, arg=1, argval='b', argrepr='b', offset=6, startsline=None, isjumptarget=False), - Instruction(opname='LOADDEREF', opcode=136, arg=2, argval='c', argrepr='c', offset=9, startsline=None, isjumptarget=False), - Instruction(opname='LOADDEREF', opcode=136, arg=3, argval='d', argrepr='d', offset=12, startsline=None, isjumptarget=False), - Instruction(opname='LOADFAST', opcode=124, arg=0, argval='e', argrepr='e', offset=15, startsline=None, isjumptarget=False), - Instruction(opname='LOADFAST', opcode=124, arg=1, argval='f', argrepr='f', offset=18, startsline=None, isjumptarget=False), - Instruction(opname='CALLFUNCTION', opcode=131, arg=6, argval=6, argrepr='6 positional, 0 keyword pair', offset=21, startsline=None, isjumptarget=False), - Instruction(opname='POPTOP', opcode=1, arg=None, argval=None, argrepr='', offset=24, startsline=None, isjumptarget=False), - Instruction(opname='LOADCONST', opcode=100, arg=0, argval=None, argrepr='None', offset=25, startsline=None, isjumptarget=False), - Instruction(opname='RETURNVALUE', opcode=83, arg=None, argval=None, argrepr='', offset=28, startsline=None, isjumptarget=False), + Instruction(opname='LOADDEREF', opcode=136, arg=0, argval='a', argrepr='a', offset=2, startsline=None, isjumptarget=False), + Instruction(opname='LOADDEREF', opcode=136, arg=1, argval='b', argrepr='b', offset=4, startsline=None, isjumptarget=False), + Instruction(opname='LOADDEREF', opcode=136, arg=2, argval='c', argrepr='c', offset=6, startsline=None, isjumptarget=False), + Instruction(opname='LOADDEREF', opcode=136, arg=3, argval='d', argrepr='d', offset=8, startsline=None, isjumptarget=False), + Instruction(opname='LOADFAST', opcode=124, arg=0, argval='e', argrepr='e', offset=10, startsline=None, isjumptarget=False), + Instruction(opname='LOADFAST', opcode=124, arg=1, argval='f', argrepr='f', offset=12, startsline=None, isjumptarget=False), + Instruction(opname='CALLFUNCTION', opcode=131, arg=6, argval=6, argrepr='6 positional, 0 keyword pair', offset=14, startsline=None, isjumptarget=False), + Instruction(opname='POPTOP', opcode=1, arg=None, argval=None, argrepr='', offset=16, startsline=None, isjumptarget=False), + Instruction(opname='LOADCONST', opcode=100, arg=0, argval=None, argrepr='None', offset=18, startsline=None, isjumptarget=False), + Instruction(opname='RETURNVALUE', opcode=83, arg=None, argval=None, argrepr='', offset=20, startsline=None, isjumptarget=False), ] expectedopinfojumpy = [ - Instruction(opname='SETUPLOOP', opcode=120, arg=68, argval=71, argrepr='to 71', offset=0, startsline=3, isjumptarget=False), - Instruction(opname='LOADGLOBAL', opcode=116, arg=0, argval='range', argrepr='range', offset=3, startsline=None, isjumptarget=False), - Instruction(opname='LOADCONST', opcode=100, arg=1, argval=10, argrepr='10', offset=6, startsline=None, isjumptarget=False), - Instruction(opname='CALLFUNCTION', opcode=131, arg=1, argval=1, argrepr='1 positional, 0 keyword pair', offset=9, startsline=None, isjumptarget=False), - Instruction(opname='GETITER', opcode=68, arg=None, argval=None, argrepr='', offset=12, startsline=None, isjumptarget=False), - Instruction(opname='FORITER', opcode=93, arg=44, argval=60, argrepr='to 60', offset=13, startsline=None, isjumptarget=True), - Instruction(opname='STOREFAST', opcode=125, arg=0, argval='i', argrepr='i', offset=16, startsline=None, isjumptarget=False), - Instruction(opname='LOADGLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=19, startsline=4, isjumptarget=False), - Instruction(opname='LOADFAST', opcode=124, arg=0, argval='i', argrepr='i', offset=22, startsline=None, isjumptarget=False), - Instruction(opname='CALLFUNCTION', opcode=131, arg=1, argval=1, argrepr='1 positional, 0 keyword pair', offset=25, startsline=None, isjumptarget=False), - Instruction(opname='POPTOP', opcode=1, arg=None, argval=None, argrepr='', offset=28, startsline=None, isjumptarget=False), - Instruction(opname='LOADFAST', opcode=124, arg=0, argval='i', argrepr='i', offset=29, startsline=5, isjumptarget=False), - Instruction(opname='LOADCONST', opcode=100, arg=2, argval=4, argrepr='4', offset=32, startsline=None, isjumptarget=False), - Instruction(opname='COMPAREOP', opcode=107, arg=0, argval='<',_ _argrepr='<', offset=35, startsline=None, isjumptarget=False),_ _- Instruction(opname='POPJUMPIFFALSE', opcode=114, arg=44, argval=44,_ _argrepr='', offset=38, startsline=None, isjumptarget=False),_ _- Instruction(opname='JUMPABSOLUTE', opcode=113, arg=13, argval=13,_ _argrepr='', offset=41, startsline=6, isjumptarget=False),_ _- Instruction(opname='LOADFAST', opcode=124, arg=0, argval='i',_ _argrepr='i', offset=44, startsline=7, isjumptarget=True),_ _- Instruction(opname='LOADCONST', opcode=100, arg=3, argval=6,_ _argrepr='6', offset=47, startsline=None, isjumptarget=False),_ _- Instruction(opname='COMPAREOP', opcode=107, arg=4, argval='>', argrepr='>', offset=50, startsline=None, isjumptarget=False), - Instruction(opname='POPJUMPIFFALSE', opcode=114, arg=13, argval=13, argrepr='', offset=53, startsline=None, isjumptarget=False), - Instruction(opname='BREAKLOOP', opcode=80, arg=None, argval=None, argrepr='', offset=56, startsline=8, isjumptarget=False), - Instruction(opname='JUMPABSOLUTE', opcode=113, arg=13, argval=13, argrepr='', offset=57, startsline=None, isjumptarget=False), - Instruction(opname='POPBLOCK', opcode=87, arg=None, argval=None, argrepr='', offset=60, startsline=None, isjumptarget=True), - Instruction(opname='LOADGLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=61, startsline=10, isjumptarget=False), - Instruction(opname='LOADCONST', opcode=100, arg=4, argval='I can haz else clause?', argrepr="'I can haz else clause?'", offset=64, startsline=None, isjumptarget=False), - Instruction(opname='CALLFUNCTION', opcode=131, arg=1, argval=1, argrepr='1 positional, 0 keyword pair', offset=67, startsline=None, isjumptarget=False), - Instruction(opname='POPTOP', opcode=1, arg=None, argval=None, argrepr='', offset=70, startsline=None, isjumptarget=False), - Instruction(opname='SETUPLOOP', opcode=120, arg=68, argval=142, argrepr='to 142', offset=71, startsline=11, isjumptarget=True), - Instruction(opname='LOADFAST', opcode=124, arg=0, argval='i', argrepr='i', offset=74, startsline=None, isjumptarget=True), - Instruction(opname='POPJUMPIFFALSE', opcode=114, arg=131, argval=131, argrepr='', offset=77, startsline=None, isjumptarget=False), - Instruction(opname='LOADGLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=80, startsline=12, isjumptarget=False), - Instruction(opname='LOADFAST', opcode=124, arg=0, argval='i', argrepr='i', offset=83, startsline=None, isjumptarget=False), - Instruction(opname='CALLFUNCTION', opcode=131, arg=1, argval=1, argrepr='1 positional, 0 keyword pair', offset=86, startsline=None, isjumptarget=False), - Instruction(opname='POPTOP', opcode=1, arg=None, argval=None, argrepr='', offset=89, startsline=None, isjumptarget=False), - Instruction(opname='LOADFAST', opcode=124, arg=0, argval='i', argrepr='i', offset=90, startsline=13, isjumptarget=False), - Instruction(opname='LOADCONST', opcode=100, arg=5, argval=1, argrepr='1', offset=93, startsline=None, isjumptarget=False), - Instruction(opname='INPLACESUBTRACT', opcode=56, arg=None, argval=None, argrepr='', offset=96, startsline=None, isjumptarget=False), - Instruction(opname='STOREFAST', opcode=125, arg=0, argval='i', argrepr='i', offset=97, startsline=None, isjumptarget=False), - Instruction(opname='LOADFAST', opcode=124, arg=0, argval='i', argrepr='i', offset=100, startsline=14, isjumptarget=False), - Instruction(opname='LOADCONST', opcode=100, arg=3, argval=6, argrepr='6', offset=103, startsline=None, isjumptarget=False), - Instruction(opname='COMPAREOP', opcode=107, arg=4, argval='>', argrepr='>', offset=106, startsline=None, isjumptarget=False), - Instruction(opname='POPJUMPIFFALSE', opcode=114, arg=115, argval=115, argrepr='', offset=109, startsline=None, isjumptarget=False), - Instruction(opname='JUMPABSOLUTE', opcode=113, arg=74, argval=74, argrepr='', offset=112, startsline=15, isjumptarget=False), - Instruction(opname='LOADFAST', opcode=124, arg=0, argval='i', argrepr='i', offset=115, startsline=16, isjumptarget=True), - Instruction(opname='LOADCONST', opcode=100, arg=2, argval=4, argrepr='4', offset=118, startsline=None, isjumptarget=False), - Instruction(opname='COMPAREOP', opcode=107, arg=0, argval='<',_ _argrepr='<', offset=121, startsline=None, isjumptarget=False),_ _- Instruction(opname='POPJUMPIFFALSE', opcode=114, arg=74, argval=74,_ _argrepr='', offset=124, startsline=None, isjumptarget=False),_ _- Instruction(opname='BREAKLOOP', opcode=80, arg=None, argval=None,_ _argrepr='', offset=127, startsline=17, isjumptarget=False),_ _- Instruction(opname='JUMPABSOLUTE', opcode=113, arg=74, argval=74,_ _argrepr='', offset=128, startsline=None, isjumptarget=False),_ _- Instruction(opname='POPBLOCK', opcode=87, arg=None, argval=None,_ _argrepr='', offset=131, startsline=None, isjumptarget=True),_ _- Instruction(opname='LOADGLOBAL', opcode=116, arg=1, argval='print',_ _argrepr='print', offset=132, startsline=19, isjumptarget=False),_ _- Instruction(opname='LOADCONST', opcode=100, arg=6, argval='Who let_ _lolcatz into this test suite?', argrepr="'Who let lolcatz into this test_ _suite?'", offset=135, startsline=None, isjumptarget=False),_ _- Instruction(opname='CALLFUNCTION', opcode=131, arg=1, argval=1,_ _argrepr='1 positional, 0 keyword pair', offset=138, startsline=None,_ _isjumptarget=False),_ _- Instruction(opname='POPTOP', opcode=1, arg=None, argval=None,_ _argrepr='', offset=141, startsline=None, isjumptarget=False),_ _- Instruction(opname='SETUPFINALLY', opcode=122, arg=73, argval=218,_ _argrepr='to 218', offset=142, startsline=20, isjumptarget=True),_ _- Instruction(opname='SETUPEXCEPT', opcode=121, arg=12, argval=160,_ _argrepr='to 160', offset=145, startsline=None, isjumptarget=False),_ _- Instruction(opname='LOADCONST', opcode=100, arg=5, argval=1,_ _argrepr='1', offset=148, startsline=21, isjumptarget=False),_ _- Instruction(opname='LOADCONST', opcode=100, arg=7, argval=0,_ _argrepr='0', offset=151, startsline=None, isjumptarget=False),_ _- Instruction(opname='BINARYTRUEDIVIDE', opcode=27, arg=None,_ _argval=None, argrepr='', offset=154, startsline=None,_ _isjumptarget=False),_ _- Instruction(opname='POPTOP', opcode=1, arg=None, argval=None,_ _argrepr='', offset=155, startsline=None, isjumptarget=False),_ _- Instruction(opname='POPBLOCK', opcode=87, arg=None, argval=None,_ _argrepr='', offset=156, startsline=None, isjumptarget=False),_ _- Instruction(opname='JUMPFORWARD', opcode=110, arg=28, argval=188,_ _argrepr='to 188', offset=157, startsline=None, isjumptarget=False),_ _- Instruction(opname='DUPTOP', opcode=4, arg=None, argval=None,_ _argrepr='', offset=160, startsline=22, isjumptarget=True),_ _- Instruction(opname='LOADGLOBAL', opcode=116, arg=2,_ _argval='ZeroDivisionError', argrepr='ZeroDivisionError', offset=161,_ _startsline=None, isjumptarget=False),_ _- Instruction(opname='COMPAREOP', opcode=107, arg=10, argval='exception_ _match', argrepr='exception match', offset=164, startsline=None,_ _isjumptarget=False),_ _- Instruction(opname='POPJUMPIFFALSE', opcode=114, arg=187,_ _argval=187, argrepr='', offset=167, startsline=None, isjumptarget=False),_ _- Instruction(opname='POPTOP', opcode=1, arg=None, argval=None,_ _argrepr='', offset=170, startsline=None, isjumptarget=False),_ _- Instruction(opname='POPTOP', opcode=1, arg=None, argval=None,_ _argrepr='', offset=171, startsline=None, isjumptarget=False),_ _- Instruction(opname='POPTOP', opcode=1, arg=None, argval=None,_ _argrepr='', offset=172, startsline=None, isjumptarget=False),_ _- Instruction(opname='LOADGLOBAL', opcode=116, arg=1, argval='print',_ _argrepr='print', offset=173, startsline=23, isjumptarget=False),_ _- Instruction(opname='LOADCONST', opcode=100, arg=8, argval='Here we go,_ _here we go, here we go...', argrepr="'Here we go, here we go, here we_ _go...'", offset=176, startsline=None, isjumptarget=False),_ _- Instruction(opname='CALLFUNCTION', opcode=131, arg=1, argval=1,_ _argrepr='1 positional, 0 keyword pair', offset=179, startsline=None,_ _isjumptarget=False),_ _- Instruction(opname='POPTOP', opcode=1, arg=None, argval=None,_ _argrepr='', offset=182, startsline=None, isjumptarget=False),_ _- Instruction(opname='POPEXCEPT', opcode=89, arg=None, argval=None,_ _argrepr='', offset=183, startsline=None, isjumptarget=False),_ _- Instruction(opname='JUMPFORWARD', opcode=110, arg=27, argval=214,_ _argrepr='to 214', offset=184, startsline=None, isjumptarget=False),_ _- Instruction(opname='ENDFINALLY', opcode=88, arg=None, argval=None,_ _argrepr='', offset=187, startsline=None, isjumptarget=True),_ _- Instruction(opname='LOADFAST', opcode=124, arg=0, argval='i',_ _argrepr='i', offset=188, startsline=25, isjumptarget=True),_ _- Instruction(opname='SETUPWITH', opcode=143, arg=17, argval=211,_ _argrepr='to 211', offset=191, startsline=None, isjumptarget=False),_ _- Instruction(opname='STOREFAST', opcode=125, arg=1, argval='dodgy',_ _argrepr='dodgy', offset=194, startsline=None, isjumptarget=False),_ _- Instruction(opname='LOADGLOBAL', opcode=116, arg=1, argval='print',_ _argrepr='print', offset=197, startsline=26, isjumptarget=False),_ _- Instruction(opname='LOADCONST', opcode=100, arg=9, argval='Never reach_ _this', argrepr="'Never reach this'", offset=200, startsline=None,_ _isjumptarget=False),_ _- Instruction(opname='CALLFUNCTION', opcode=131, arg=1, argval=1,_ _argrepr='1 positional, 0 keyword pair', offset=203, startsline=None,_ _isjumptarget=False),_ _- Instruction(opname='POPTOP', opcode=1, arg=None, argval=None,_ _argrepr='', offset=206, startsline=None, isjumptarget=False),_ _- Instruction(opname='POPBLOCK', opcode=87, arg=None, argval=None,_ _argrepr='', offset=207, startsline=None, isjumptarget=False),_ _- Instruction(opname='LOADCONST', opcode=100, arg=0, argval=None,_ _argrepr='None', offset=208, startsline=None, isjumptarget=False),_ _- Instruction(opname='WITHCLEANUPSTART', opcode=81, arg=None,_ _argval=None, argrepr='', offset=211, startsline=None, isjumptarget=True),_ _- Instruction(opname='WITHCLEANUPFINISH', opcode=82, arg=None,_ _argval=None, argrepr='', offset=212, startsline=None,_ _isjumptarget=False),_ _- Instruction(opname='ENDFINALLY', opcode=88, arg=None, argval=None,_ _argrepr='', offset=213, startsline=None, isjumptarget=False),_ _- Instruction(opname='POPBLOCK', opcode=87, arg=None, argval=None,_ _argrepr='', offset=214, startsline=None, isjumptarget=True),_ _- Instruction(opname='LOADCONST', opcode=100, arg=0, argval=None,_ _argrepr='None', offset=215, startsline=None, isjumptarget=False),_ _- Instruction(opname='LOADGLOBAL', opcode=116, arg=1, argval='print',_ _argrepr='print', offset=218, startsline=28, isjumptarget=True),_ _- Instruction(opname='LOADCONST', opcode=100, arg=10, argval="OK, now_ _we're done", argrepr='"OK, now we're done"', offset=221, startsline=None,_ _isjumptarget=False),_ _- Instruction(opname='CALLFUNCTION', opcode=131, arg=1, argval=1,_ _argrepr='1 positional, 0 keyword pair', offset=224, startsline=None,_ _isjumptarget=False),_ _- Instruction(opname='POPTOP', opcode=1, arg=None, argval=None,_ _argrepr='', offset=227, startsline=None, isjumptarget=False),_ _- Instruction(opname='ENDFINALLY', opcode=88, arg=None, argval=None,_ _argrepr='', offset=228, startsline=None, isjumptarget=False),_ _- Instruction(opname='LOADCONST', opcode=100, arg=0, argval=None,_ _argrepr='None', offset=229, startsline=None, isjumptarget=False),_ _- Instruction(opname='RETURNVALUE', opcode=83, arg=None, argval=None,_ _argrepr='', offset=232, startsline=None, isjumptarget=False),_ _+ Instruction(opname='SETUPLOOP', opcode=120, arg=52, argval=54,_ _argrepr='to 54', offset=0, startsline=3, isjumptarget=False),_ _+ Instruction(opname='LOADGLOBAL', opcode=116, arg=0, argval='range',_ _argrepr='range', offset=2, startsline=None, isjumptarget=False),_ _+ Instruction(opname='LOADCONST', opcode=100, arg=1, argval=10,_ _argrepr='10', offset=4, startsline=None, isjumptarget=False),_ _+ Instruction(opname='CALLFUNCTION', opcode=131, arg=1, argval=1,_ _argrepr='1 positional, 0 keyword pair', offset=6, startsline=None,_ _isjumptarget=False),_ _+ Instruction(opname='GETITER', opcode=68, arg=None, argval=None,_ _argrepr='', offset=8, startsline=None, isjumptarget=False),_ _+ Instruction(opname='FORITER', opcode=93, arg=32, argval=44,_ _argrepr='to 44', offset=10, startsline=None, isjumptarget=True),_ _+ Instruction(opname='STOREFAST', opcode=125, arg=0, argval='i',_ _argrepr='i', offset=12, startsline=None, isjumptarget=False),_ _+ Instruction(opname='LOADGLOBAL', opcode=116, arg=1, argval='print',_ _argrepr='print', offset=14, startsline=4, isjumptarget=False),_ _+ Instruction(opname='LOADFAST', opcode=124, arg=0, argval='i',_ _argrepr='i', offset=16, startsline=None, isjumptarget=False),_ _+ Instruction(opname='CALLFUNCTION', opcode=131, arg=1, argval=1,_ _argrepr='1 positional, 0 keyword pair', offset=18, startsline=None,_ _isjumptarget=False),_ _+ Instruction(opname='POPTOP', opcode=1, arg=None, argval=None,_ _argrepr='', offset=20, startsline=None, isjumptarget=False),_ _+ Instruction(opname='LOADFAST', opcode=124, arg=0, argval='i',_ _argrepr='i', offset=22, startsline=5, isjumptarget=False),_ _+ Instruction(opname='LOADCONST', opcode=100, arg=2, argval=4,_ _argrepr='4', offset=24, startsline=None, isjumptarget=False),_ _+ Instruction(opname='COMPAREOP', opcode=107, arg=0, argval='<',_ _argrepr='<', offset=26, startsline=None, isjumptarget=False),_ _+ Instruction(opname='POPJUMPIFFALSE', opcode=114, arg=32, argval=32,_ _argrepr='', offset=28, startsline=None, isjumptarget=False),_ _+ Instruction(opname='JUMPABSOLUTE', opcode=113, arg=10, argval=10,_ _argrepr='', offset=30, startsline=6, isjumptarget=False),_ _+ Instruction(opname='LOADFAST', opcode=124, arg=0, argval='i',_ _argrepr='i', offset=32, startsline=7, isjumptarget=True),_ _+ Instruction(opname='LOADCONST', opcode=100, arg=3, argval=6,_ _argrepr='6', offset=34, startsline=None, isjumptarget=False),_ _+ Instruction(opname='COMPAREOP', opcode=107, arg=4, argval='>', argrepr='>', offset=36, startsline=None, isjumptarget=False), + Instruction(opname='POPJUMPIFFALSE', opcode=114, arg=10, argval=10, argrepr='', offset=38, startsline=None, isjumptarget=False), + Instruction(opname='BREAKLOOP', opcode=80, arg=None, argval=None, argrepr='', offset=40, startsline=8, isjumptarget=False), + Instruction(opname='JUMPABSOLUTE', opcode=113, arg=10, argval=10, argrepr='', offset=42, startsline=None, isjumptarget=False), + Instruction(opname='POPBLOCK', opcode=87, arg=None, argval=None, argrepr='', offset=44, startsline=None, isjumptarget=True), + Instruction(opname='LOADGLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=46, startsline=10, isjumptarget=False), + Instruction(opname='LOADCONST', opcode=100, arg=4, argval='I can haz else clause?', argrepr="'I can haz else clause?'", offset=48, startsline=None, isjumptarget=False), + Instruction(opname='CALLFUNCTION', opcode=131, arg=1, argval=1, argrepr='1 positional, 0 keyword pair', offset=50, startsline=None, isjumptarget=False), + Instruction(opname='POPTOP', opcode=1, arg=None, argval=None, argrepr='', offset=52, startsline=None, isjumptarget=False), + Instruction(opname='SETUPLOOP', opcode=120, arg=52, argval=108, argrepr='to 108', offset=54, startsline=11, isjumptarget=True), + Instruction(opname='LOADFAST', opcode=124, arg=0, argval='i', argrepr='i', offset=56, startsline=None, isjumptarget=True), + Instruction(opname='POPJUMPIFFALSE', opcode=114, arg=98, argval=98, argrepr='', offset=58, startsline=None, isjumptarget=False), + Instruction(opname='LOADGLOBAL', opcode=116, arg=1, argval='print', argrepr='print', offset=60, startsline=12, isjumptarget=False), + Instruction(opname='LOADFAST', opcode=124, arg=0, argval='i', argrepr='i', offset=62, startsline=None, isjumptarget=False), + Instruction(opname='CALLFUNCTION', opcode=131, arg=1, argval=1, argrepr='1 positional, 0 keyword pair', offset=64, startsline=None, isjumptarget=False), + Instruction(opname='POPTOP', opcode=1, arg=None, argval=None, argrepr='', offset=66, startsline=None, isjumptarget=False), + Instruction(opname='LOADFAST', opcode=124, arg=0, argval='i', argrepr='i', offset=68, startsline=13, isjumptarget=False), + Instruction(opname='LOADCONST', opcode=100, arg=5, argval=1, argrepr='1', offset=70, startsline=None, isjumptarget=False), + Instruction(opname='INPLACESUBTRACT', opcode=56, arg=None, argval=None, argrepr='', offset=72, startsline=None, isjumptarget=False), + Instruction(opname='STOREFAST', opcode=125, arg=0, argval='i', argrepr='i', offset=74, startsline=None, isjumptarget=False), + Instruction(opname='LOADFAST', opcode=124, arg=0, argval='i', argrepr='i', offset=76, startsline=14, isjumptarget=False), + Instruction(opname='LOADCONST', opcode=100, arg=3, argval=6, argrepr='6', offset=78, startsline=None, isjumptarget=False), + Instruction(opname='COMPAREOP', opcode=107, arg=4, argval='>', argrepr='>', offset=80, startsline=None, isjumptarget=False), + Instruction(opname='POPJUMPIFFALSE', opcode=114, arg=86, argval=86, argrepr='', offset=82, startsline=None, isjumptarget=False), + Instruction(opname='JUMPABSOLUTE', opcode=113, arg=56, argval=56, argrepr='', offset=84, startsline=15, isjumptarget=False), + Instruction(opname='LOADFAST', opcode=124, arg=0, argval='i', argrepr='i', offset=86, startsline=16, isjumptarget=True), + Instruction(opname='LOADCONST', opcode=100, arg=2, argval=4, argrepr='4', offset=88, startsline=None, isjumptarget=False), + Instruction(opname='COMPAREOP', opcode=107, arg=0, argval='<',_ _argrepr='<', offset=90, startsline=None, isjumptarget=False),_ _+ Instruction(opname='POPJUMPIFFALSE', opcode=114, arg=56, argval=56,_ _argrepr='', offset=92, startsline=None, isjumptarget=False),_ _+ Instruction(opname='BREAKLOOP', opcode=80, arg=None, argval=None,_ _argrepr='', offset=94, startsline=17, isjumptarget=False),_ _+ Instruction(opname='JUMPABSOLUTE', opcode=113, arg=56, argval=56,_ _argrepr='', offset=96, startsline=None, isjumptarget=False),_ _+ Instruction(opname='POPBLOCK', opcode=87, arg=None, argval=None,_ _argrepr='', offset=98, startsline=None, isjumptarget=True),_ _+ Instruction(opname='LOADGLOBAL', opcode=116, arg=1, argval='print',_ _argrepr='print', offset=100, startsline=19, isjumptarget=False),_ _+ Instruction(opname='LOADCONST', opcode=100, arg=6, argval='Who let_ _lolcatz into this test suite?', argrepr="'Who let lolcatz into this test_ _suite?'", offset=102, startsline=None, isjumptarget=False),_ _+ Instruction(opname='CALLFUNCTION', opcode=131, arg=1, argval=1,_ _argrepr='1 positional, 0 keyword pair', offset=104, startsline=None,_ _isjumptarget=False),_ _+ Instruction(opname='POPTOP', opcode=1, arg=None, argval=None,_ _argrepr='', offset=106, startsline=None, isjumptarget=False),_ _+ Instruction(opname='SETUPFINALLY', opcode=122, arg=70, argval=180,_ _argrepr='to 180', offset=108, startsline=20, isjumptarget=True),_ _+ Instruction(opname='SETUPEXCEPT', opcode=121, arg=12, argval=124,_ _argrepr='to 124', offset=110, startsline=None, isjumptarget=False),_ _+ Instruction(opname='LOADCONST', opcode=100, arg=5, argval=1,_ _argrepr='1', offset=112, startsline=21, isjumptarget=False),_ _+ Instruction(opname='LOADCONST', opcode=100, arg=7, argval=0,_ _argrepr='0', offset=114, startsline=None, isjumptarget=False),_ _+ Instruction(opname='BINARYTRUEDIVIDE', opcode=27, arg=None,_ _argval=None, argrepr='', offset=116, startsline=None,_ _isjumptarget=False),_ _+ Instruction(opname='POPTOP', opcode=1, arg=None, argval=None,_ _argrepr='', offset=118, startsline=None, isjumptarget=False),_ _+ Instruction(opname='POPBLOCK', opcode=87, arg=None, argval=None,_ _argrepr='', offset=120, startsline=None, isjumptarget=False),_ _+ Instruction(opname='JUMPFORWARD', opcode=110, arg=28, argval=152,_ _argrepr='to 152', offset=122, startsline=None, isjumptarget=False),_ _+ Instruction(opname='DUPTOP', opcode=4, arg=None, argval=None,_ _argrepr='', offset=124, startsline=22, isjumptarget=True),_ _+ Instruction(opname='LOADGLOBAL', opcode=116, arg=2,_ _argval='ZeroDivisionError', argrepr='ZeroDivisionError', offset=126,_ _startsline=None, isjumptarget=False),_ _+ Instruction(opname='COMPAREOP', opcode=107, arg=10, argval='exception_ _match', argrepr='exception match', offset=128, startsline=None,_ _isjumptarget=False),_ _+ Instruction(opname='POPJUMPIFFALSE', opcode=114, arg=150,_ _argval=150, argrepr='', offset=130, startsline=None, isjumptarget=False),_ _+ Instruction(opname='POPTOP', opcode=1, arg=None, argval=None,_ _argrepr='', offset=132, startsline=None, isjumptarget=False),_ _+ Instruction(opname='POPTOP', opcode=1, arg=None, argval=None,_ _argrepr='', offset=134, startsline=None, isjumptarget=False),_ _+ Instruction(opname='POPTOP', opcode=1, arg=None, argval=None,_ _argrepr='', offset=136, startsline=None, isjumptarget=False),_ _+ Instruction(opname='LOADGLOBAL', opcode=116, arg=1, argval='print',_ _argrepr='print', offset=138, startsline=23, isjumptarget=False),_ _+ Instruction(opname='LOADCONST', opcode=100, arg=8, argval='Here we go,_ _here we go, here we go...', argrepr="'Here we go, here we go, here we_ _go...'", offset=140, startsline=None, isjumptarget=False),_ _+ Instruction(opname='CALLFUNCTION', opcode=131, arg=1, argval=1,_ _argrepr='1 positional, 0 keyword pair', offset=142, startsline=None,_ _isjumptarget=False),_ _+ Instruction(opname='POPTOP', opcode=1, arg=None, argval=None,_ _argrepr='', offset=144, startsline=None, isjumptarget=False),_ _+ Instruction(opname='POPEXCEPT', opcode=89, arg=None, argval=None,_ _argrepr='', offset=146, startsline=None, isjumptarget=False),_ _+ Instruction(opname='JUMPFORWARD', opcode=110, arg=26, argval=176,_ _argrepr='to 176', offset=148, startsline=None, isjumptarget=False),_ _+ Instruction(opname='ENDFINALLY', opcode=88, arg=None, argval=None,_ _argrepr='', offset=150, startsline=None, isjumptarget=True),_ _+ Instruction(opname='LOADFAST', opcode=124, arg=0, argval='i',_ _argrepr='i', offset=152, startsline=25, isjumptarget=True),_ _+ Instruction(opname='SETUPWITH', opcode=143, arg=14, argval=170,_ _argrepr='to 170', offset=154, startsline=None, isjumptarget=False),_ _+ Instruction(opname='STOREFAST', opcode=125, arg=1, argval='dodgy',_ _argrepr='dodgy', offset=156, startsline=None, isjumptarget=False),_ _+ Instruction(opname='LOADGLOBAL', opcode=116, arg=1, argval='print',_ _argrepr='print', offset=158, startsline=26, isjumptarget=False),_ _+ Instruction(opname='LOADCONST', opcode=100, arg=9, argval='Never reach_ _this', argrepr="'Never reach this'", offset=160, startsline=None,_ _isjumptarget=False),_ _+ Instruction(opname='CALLFUNCTION', opcode=131, arg=1, argval=1,_ _argrepr='1 positional, 0 keyword pair', offset=162, startsline=None,_ _isjumptarget=False),_ _+ Instruction(opname='POPTOP', opcode=1, arg=None, argval=None,_ _argrepr='', offset=164, startsline=None, isjumptarget=False),_ _+ Instruction(opname='POPBLOCK', opcode=87, arg=None, argval=None,_ _argrepr='', offset=166, startsline=None, isjumptarget=False),_ _+ Instruction(opname='LOADCONST', opcode=100, arg=0, argval=None,_ _argrepr='None', offset=168, startsline=None, isjumptarget=False),_ _+ Instruction(opname='WITHCLEANUPSTART', opcode=81, arg=None,_ _argval=None, argrepr='', offset=170, startsline=None, isjumptarget=True),_ _+ Instruction(opname='WITHCLEANUPFINISH', opcode=82, arg=None,_ _argval=None, argrepr='', offset=172, startsline=None,_ _isjumptarget=False),_ _+ Instruction(opname='ENDFINALLY', opcode=88, arg=None, argval=None,_ _argrepr='', offset=174, startsline=None, isjumptarget=False),_ _+ Instruction(opname='POPBLOCK', opcode=87, arg=None, argval=None,_ _argrepr='', offset=176, startsline=None, isjumptarget=True),_ _+ Instruction(opname='LOADCONST', opcode=100, arg=0, argval=None,_ _argrepr='None', offset=178, startsline=None, isjumptarget=False),_ _+ Instruction(opname='LOADGLOBAL', opcode=116, arg=1, argval='print',_ _argrepr='print', offset=180, startsline=28, isjumptarget=True),_ _+ Instruction(opname='LOADCONST', opcode=100, arg=10, argval="OK, now_ _we're done", argrepr='"OK, now we're done"', offset=182, startsline=None,_ _isjumptarget=False),_ _+ Instruction(opname='CALLFUNCTION', opcode=131, arg=1, argval=1,_ _argrepr='1 positional, 0 keyword pair', offset=184, startsline=None,_ _isjumptarget=False),_ _+ Instruction(opname='POPTOP', opcode=1, arg=None, argval=None,_ _argrepr='', offset=186, startsline=None, isjumptarget=False),_ _+ Instruction(opname='ENDFINALLY', opcode=88, arg=None, argval=None,_ _argrepr='', offset=188, startsline=None, isjumptarget=False),_ _+ Instruction(opname='LOADCONST', opcode=100, arg=0, argval=None,_ _argrepr='None', offset=190, startsline=None, isjumptarget=False),_ _+ Instruction(opname='RETURNVALUE', opcode=83, arg=None, argval=None,_ _argrepr='', offset=192, startsline=None, isjumptarget=False),_ _]_ _# One last piece of inspect fodder to check the default line number_ _handling_ _def simple(): pass_ _expectedopinfosimple = [_ _Instruction(opname='LOADCONST', opcode=100, arg=0, argval=None,_ _argrepr='None', offset=0, startsline=simple._code_.cofirstlineno,_ _isjumptarget=False),_ _- Instruction(opname='RETURNVALUE', opcode=83, arg=None, argval=None,_ _argrepr='', offset=3, startsline=None, isjumptarget=False)_ _+ Instruction(opname='RETURNVALUE', opcode=83, arg=None, argval=None,_ _argrepr='', offset=2, startsline=None, isjumptarget=False)_ _]_ _diff --git a/Misc/NEWS b/Misc/NEWS_ _--- a/Misc/NEWS_ _+++ b/Misc/NEWS_ _@@ -10,6 +10,9 @@_ _Core and Builtins_ _-----------------_ _+- Issue #26647: Python interpreter now uses 16-bit wordcode instead of_ _bytecode._ _+ Patch by Demur Rumed._ _+_ _- Issue #23275: Allow assigning to an empty target list in round brackets:_ _() = iterable._ _diff --git a/Objects/frameobject.c b/Objects/frameobject.c_ _--- a/Objects/frameobject.c_ _+++ b/Objects/frameobject.c_ _@@ -189,7 +189,7 @@_ _memset(blockstack, '\0', sizeof(blockstack));_ _memset(infinally, '\0', sizeof(infinally));_ _blockstacktop = 0;_ _- for (addr = 0; addr < codelen; addr++) {_ _+ for (addr = 0; addr < codelen; addr += 2) {_ _unsigned char op = code[addr];_ _switch (op) {_ _case SETUPLOOP:_ _@@ -251,10 +251,6 @@_ _}_ _}_ _}_ _-_ _- if (op >= HAVEARGUMENT) { - addr += 2; - } } /* Verify that the blockstack tracking code didn't get lost. */ @@ -277,7 +273,7 @@ * can tell whether the jump goes into any blocks without coming out * again - in that case we raise an exception below. */ deltaiblock = 0; - for (addr = minaddr; addr < maxaddr; addr++) {_ _+ for (addr = minaddr; addr < maxaddr; addr += 2) {_ _unsigned char op = code[addr];_ _switch (op) {_ _case SETUPLOOP:_ _@@ -294,10 +290,6 @@_ _}_ _mindeltaiblock = PyMIN(mindeltaiblock, deltaiblock);_ _-_ _- if (op >= HAVEARGUMENT) { - addr += 2; - } } /* Derive the absolute iblock values from the deltas. */ diff --git a/Objects/genobject.c b/Objects/genobject.c --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -277,7 +277,7 @@ PyObject *bytecode = f->fcode->cocode; unsigned char *code = (unsigned char *)PyBytesASSTRING(bytecode); - if (code[f->flasti + 1] != YIELDFROM) + if (code[f->flasti + 2] != YIELDFROM) return NULL; yf = f->fstacktop[-1]; PyINCREF(yf); @@ -376,7 +376,7 @@ assert(ret == yf); PyDECREF(ret); /* Termination repetition of YIELDFROM */ - gen->giframe->flasti++; + gen->giframe->flasti += 2; if (PyGenFetchStopIterationValue(&val) == 0) { ret = gensendex(gen, val, 0, 0); PyDECREF(val); diff --git a/PC/launcher.c b/PC/launcher.c --- a/PC/launcher.c +++ b/PC/launcher.c @@ -1089,7 +1089,7 @@ { 3190, 3230, L"3.3" }, { 3250, 3310, L"3.4" }, { 3320, 3350, L"3.5" }, - { 3360, 3361, L"3.6" }, + { 3360, 3370, L"3.6" }, { 0 } }; diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -209,6 +209,7 @@ + diff --git a/PCbuild/pythoncore.vcxproj.filters b/PCbuild/pythoncore.vcxproj.filters --- a/PCbuild/pythoncore.vcxproj.filters +++ b/PCbuild/pythoncore.vcxproj.filters @@ -420,6 +420,9 @@ Python + + Python + Python diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -886,24 +886,10 @@ /* Import the static jump table */ #include "opcodetargets.h" -/* This macro is used when several opcodes defer to the same implementation - (e.g. SETUPLOOP, SETUPFINALLY) */ _-#define TARGETWITHIMPL(op, impl) _ _- TARGET##op: _ _- opcode = op; _ _- if (HASARG(op)) _ _- oparg = NEXTARG(); _ _- case op: _ _- goto impl; _ - _#define TARGET(op) _ _TARGET##op: _ _- opcode = op; _ _- if (HASARG(op)) _ _- oparg = NEXTARG(); _ case op: - _#define DISPATCH() _ _{ _ _if (!Pyatomicloadrelaxed(&evalbreaker)) { _ @@ -917,7 +903,9 @@ _{ _ _if (!lltrace && !PyTracingPossible) { _ _f->flasti = INSTROFFSET(); _ _- goto *opcodetargets[*nextinstr++]; _ _+ opcode = NEXTOP(); _ _+ oparg = NEXTARG(); _ _+ goto *opcodetargets[opcode]; _ _} _ _goto fastnextopcode; _ } @@ -926,7 +914,9 @@ _{ _ _if (!PyTracingPossible) { _ _f->flasti = INSTROFFSET(); _ _- goto *opcodetargets[*nextinstr++]; _ _+ opcode = NEXTOP(); _ _+ oparg = NEXTARG(); _ _+ goto opcodetargets[opcode]; _ _} _ _goto fastnextopcode; _ } @@ -935,10 +925,7 @@ #else _#define TARGET(op) _ case op: _-#define TARGETWITHIMPL(op, impl) _ _- / silence compiler warnings about impl unused */ _ _- if (0) goto impl; _ - case op: + #define DISPATCH() continue #define FASTDISPATCH() goto fastnextopcod -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20160524/04eb66b8/attachment-0001.html>



More information about the Python-Dev mailing list