diff options
author | Eric V. Smith <eric@trueblade.com> | 2015-11-03 18:09:01 (GMT) |
---|---|---|
committer | Eric V. Smith <eric@trueblade.com> | 2015-11-03 18:09:01 (GMT) |
commit | 281d5321a3bdee1fd7091e439855c0358371216c (patch) | |
tree | aa2d829e27d8396eb5412d98c8ee57f73cbc0740 | |
parent | a78c7954d549fba967a842143b4e3050ff488468 (diff) | |
download | cpython-281d5321a3bdee1fd7091e439855c0358371216c.zip cpython-281d5321a3bdee1fd7091e439855c0358371216c.tar.gz cpython-281d5321a3bdee1fd7091e439855c0358371216c.tar.bz2 |
Issue 25483: Update dis.rst with FORMAT_VALUE opcode description.
-rw-r--r-- | Doc/library/dis.rst | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 1bcb3a4..c6e1656 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -989,6 +989,25 @@ the more significant byte last. arguments. +.. opcode:: FORMAT_VALUE (flags) + + Used for implementing formatted literal strings (f-strings). Pops + an optional *fmt_spec* from the stack, then a required *value*. + *flags* is interpreted as follows: + + * ``(flags & 0x03) == 0x00``: *value* is formattedd as-is. + * ``(flags & 0x03) == 0x01``: call :func:`str` on *value* before + formatting it. + * ``(flags & 0x03) == 0x02``: call :func:`repr` on *value* before + formatting it. + * ``(flags & 0x03) == 0x03``: call :func:`ascii` on *value* before + formatting it. + * ``(flags & 0x04) == 0x04``: pop *fmt_spec* from the stack and use + it, else use an empty *fmt_spec*. + + Formatting is performed using the :c:func:`PyObject_Format` function. + + .. opcode:: HAVE_ARGUMENT This is not really an opcode. It identifies the dividing line between |