[Python-checkins] cpython: Issue 25483: Update dis.rst with FORMAT_VALUE opcode description.
eric.smith
python-checkins at python.org
Tue Nov 3 13:09:17 EST 2015
https://hg.python.org/cpython/rev/4734713a31ed
changeset: 98946:4734713a31ed
user: Eric V. Smith <eric at trueblade.com>
date: Tue Nov 03 13:09:01 2015 -0500
summary:
Issue 25483: Update dis.rst with FORMAT_VALUE opcode description.
files:
Doc/library/dis.rst | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst
--- a/Doc/library/dis.rst
+++ b/Doc/library/dis.rst
@@ -989,6 +989,25 @@
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
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list