mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
Issue #28317: The disassembler now decodes FORMAT_VALUE argument.
This commit is contained in:
parent
56588b7055
commit
dd102f7af8
3 changed files with 35 additions and 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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue