diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-10-08 09:34:25 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-10-08 09:34:25 (GMT) |
commit | dd102f7af8bc319205e7efd726af48d50a5ac103 (patch) | |
tree | d5feac621292f0f9e773b9e91b264dcde5e16e88 /Lib/dis.py | |
parent | 56588b7055a3c503bb7226a41d10be47f4bf2d58 (diff) | |
download | cpython-dd102f7af8bc319205e7efd726af48d50a5ac103.zip cpython-dd102f7af8bc319205e7efd726af48d50a5ac103.tar.gz cpython-dd102f7af8bc319205e7efd726af48d50a5ac103.tar.bz2 |
Issue #28317: The disassembler now decodes FORMAT_VALUE argument.
Diffstat (limited to 'Lib/dis.py')
-rw-r--r-- | Lib/dis.py | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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) |