[issue28317] Improve support of FORMAT_VALUE in dis

Serhiy Storchaka report at bugs.python.org
Fri Sep 30 10:21:20 EDT 2016


New submission from Serhiy Storchaka:

FORMAT_VALUE packs the information about conversion flags and boolean flag that denotes whether format specifier is passed on the stack in one integer argument. It is not easy to decode this information in disassemble output. Proposed patch makes disassembler producing human readable representation of FORMAT_VALUE argument.

$ echo 'f"{a} {b:4} {c!r} {d!r:4}"' | ./python -m dis
  1           0 LOAD_NAME                0 (a)
              2 FORMAT_VALUE             0
              4 LOAD_CONST               0 (' ')
              6 LOAD_NAME                1 (b)
              8 LOAD_CONST               1 ('4')
             10 FORMAT_VALUE             4 (with format)
             12 LOAD_CONST               0 (' ')
             14 LOAD_NAME                2 (c)
             16 FORMAT_VALUE             2 (repr)
             18 LOAD_CONST               0 (' ')
             20 LOAD_NAME                3 (d)
             22 LOAD_CONST               1 ('4')
             24 FORMAT_VALUE             6 (repr, with format)
             26 BUILD_STRING             7
             28 POP_TOP
             30 LOAD_CONST               2 (None)
             32 RETURN_VALUE

----------
components: Library (Lib)
files: dis_format_string.patch
keywords: patch
messages: 277754
nosy: eric.smith, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Improve support of FORMAT_VALUE in dis
type: enhancement
versions: Python 3.6, Python 3.7
Added file: http://bugs.python.org/file44892/dis_format_string.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28317>
_______________________________________


More information about the Python-bugs-list mailing list