@@ -1465,26 +1465,47 @@ iterations of the loop.
14651465 an argument from two-byte to four-byte.
14661466
14671467
1468- .. opcode :: FORMAT_VALUE (flags )
1468+ .. opcode :: CONVERT_VALUE (oparg )
14691469
1470- Used for implementing formatted literal strings (f-strings). Pops
1471- an optional *fmt_spec * from the stack, then a required *value *.
1472- *flags * is interpreted as follows:
1470+ Convert value to a string, depending on ``oparg ``::
14731471
1474- * ``(flags & 0x03) == 0x00 ``: *value * is formatted as-is.
1475- * ``(flags & 0x03) == 0x01 ``: call :func: `str ` on *value * before
1476- formatting it.
1477- * ``(flags & 0x03) == 0x02 ``: call :func: `repr ` on *value * before
1478- formatting it.
1479- * ``(flags & 0x03) == 0x03 ``: call :func: `ascii ` on *value * before
1480- formatting it.
1481- * ``(flags & 0x04) == 0x04 ``: pop *fmt_spec * from the stack and use
1482- it, else use an empty *fmt_spec *.
1472+ value = STACK.pop()
1473+ result = func(value)
1474+ STACK.push(result)
14831475
1484- Formatting is performed using :c:func: `PyObject_Format `. The
1485- result is pushed on the stack.
1476+ * ``oparg == 1 ``: call :func: `str ` on *value *
1477+ * ``oparg == 2 ``: call :func: `repr ` on *value *
1478+ * ``oparg == 3 ``: call :func: `ascii ` on *value *
14861479
1487- .. versionadded :: 3.6
1480+ Used for implementing formatted literal strings (f-strings).
1481+
1482+ .. versionadded :: 3.13
1483+
1484+
1485+ .. opcode :: FORMAT_SIMPLE
1486+
1487+ Formats the value on top of stack::
1488+
1489+ value = STACK.pop()
1490+ result = value.__format__("")
1491+ STACK.push(result)
1492+
1493+ Used for implementing formatted literal strings (f-strings).
1494+
1495+ .. versionadded :: 3.13
1496+
1497+ .. opcode :: FORMAT_SPEC
1498+
1499+ Formats the given value with the given format spec::
1500+
1501+ spec = STACK.pop()
1502+ value = STACK.pop()
1503+ result = value.__format__(spec)
1504+ STACK.push(result)
1505+
1506+ Used for implementing formatted literal strings (f-strings).
1507+
1508+ .. versionadded :: 3.13
14881509
14891510
14901511.. opcode :: MATCH_CLASS (count)
0 commit comments