From 17668cfa5e0e6f50376cc233d9b063b908a19845 Mon Sep 17 00:00:00 2001 From: Yury Selivanov Date: Thu, 8 Sep 2016 22:01:51 -0700 Subject: Issue #28003: Implement PEP 525 -- Asynchronous Generators. --- Lib/dis.py | 1 + 1 file changed, 1 insertion(+) (limited to 'Lib/dis.py') diff --git a/Lib/dis.py b/Lib/dis.py index 59886f1e37..556d84eb4a 100644 --- a/Lib/dis.py +++ b/Lib/dis.py @@ -87,6 +87,7 @@ COMPILER_FLAG_NAMES = { 64: "NOFREE", 128: "COROUTINE", 256: "ITERABLE_COROUTINE", + 512: "ASYNC_GENERATOR", } def pretty_flags(flags): -- cgit v1.2.1 From 2b5865ab2c78d3bdaf8ad7047762b5d0d41d8654 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 9 Sep 2016 10:17:08 -0700 Subject: Rework CALL_FUNCTION* opcodes Issue #27213: Rework CALL_FUNCTION* opcodes to produce shorter and more efficient bytecode: * CALL_FUNCTION now only accepts position arguments * CALL_FUNCTION_KW accepts position arguments and keyword arguments, but keys of keyword arguments are packed into a constant tuple. * CALL_FUNCTION_EX is the most generic, it expects a tuple and a dict for positional and keyword arguments. CALL_FUNCTION_VAR and CALL_FUNCTION_VAR_KW opcodes have been removed. 2 tests of test_traceback are currently broken: skip test, the issue #28050 was created to track the issue. Patch by Demur Rumed, design by Serhiy Storchaka, reviewed by Serhiy Storchaka and Victor Stinner. --- Lib/dis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Lib/dis.py') diff --git a/Lib/dis.py b/Lib/dis.py index 556d84eb4a..e958c8ad1c 100644 --- a/Lib/dis.py +++ b/Lib/dis.py @@ -314,7 +314,7 @@ def _get_instructions_bytes(code, varnames=None, names=None, constants=None, argrepr = argval elif op in hasfree: argval, argrepr = _get_name_info(arg, cells) - elif op in hasnargs: + elif op in hasnargs: # unused argrepr = "%d positional, %d keyword pair" % (arg%256, arg//256) yield Instruction(opname[op], op, arg, argval, argrepr, -- cgit v1.2.1 From e74d571e49d3fdb4389b79fa1392dd75e2acb916 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Mon, 12 Sep 2016 00:52:40 +0300 Subject: Issue #27213: Fixed different issues with reworked CALL_FUNCTION* opcodes. * BUILD_TUPLE_UNPACK and BUILD_MAP_UNPACK_WITH_CALL no longer generated with single tuple or dict. * Restored more informative error messages for incorrect var-positional and var-keyword arguments. * Removed code duplications in _PyEval_EvalCodeWithName(). * Removed redundant runtime checks and parameters in _PyStack_AsDict(). * Added a workaround and enabled previously disabled test in test_traceback. * Removed dead code from the dis module. --- Lib/dis.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'Lib/dis.py') diff --git a/Lib/dis.py b/Lib/dis.py index e958c8ad1c..3a706be3c8 100644 --- a/Lib/dis.py +++ b/Lib/dis.py @@ -314,8 +314,6 @@ def _get_instructions_bytes(code, varnames=None, names=None, constants=None, argrepr = argval elif op in hasfree: argval, argrepr = _get_name_info(arg, cells) - elif op in hasnargs: # unused - argrepr = "%d positional, %d keyword pair" % (arg%256, arg//256) yield Instruction(opname[op], op, arg, argval, argrepr, offset, starts_line, is_jump_target) -- cgit v1.2.1 From 0a6295517e3c339b27e602d3816746bf43506dc3 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sat, 8 Oct 2016 12:34:25 +0300 Subject: Issue #28317: The disassembler now decodes FORMAT_VALUE argument. --- Lib/dis.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Lib/dis.py') diff --git a/Lib/dis.py b/Lib/dis.py index 3a706be3c8..0794b7f743 100644 --- a/Lib/dis.py +++ b/Lib/dis.py @@ -16,6 +16,8 @@ del _opcodes_all _have_code = (types.MethodType, types.FunctionType, types.CodeType, classmethod, staticmethod, type) +FORMAT_VALUE = opmap['FORMAT_VALUE'] + def _try_compile(source, name): """Attempts to compile the given source, first as an expression and then as a statement if the first approach fails. @@ -314,6 +316,13 @@ def _get_instructions_bytes(code, varnames=None, names=None, constants=None, argrepr = argval elif op in hasfree: argval, argrepr = _get_name_info(arg, cells) + elif op == FORMAT_VALUE: + argval = ((None, str, repr, ascii)[arg & 0x3], bool(arg & 0x4)) + argrepr = ('', 'str', 'repr', 'ascii')[arg & 0x3] + if argval[1]: + if argrepr: + argrepr += ', ' + argrepr += 'with format' yield Instruction(opname[op], op, arg, argval, argrepr, offset, starts_line, is_jump_target) -- cgit v1.2.1