Skip to content

Commit e88843c

Browse files
committed
Improve text on whitespace in f-string debug expressions
1 parent 5fdb129 commit e88843c

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Doc/reference/lexical_analysis.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,9 +1097,15 @@ Whitespace is significant in these situations:
10971097
* Whitespace in :py:data:`~token.FSTRING_MIDDLE` is part of the literal
10981098
string contents.
10991099
* In ``fstring_replacement_field``, if ``f_debug_specifier`` is present,
1100-
all whitespace after the opening brace up to the ``!`` of
1101-
``fstring_conversion``, ``:`` of ``fstring_full_format_spec``,
1102-
or the closing brace, is retained as part of the expression.
1100+
all whitespace after the opening brace until the ``f_debug_specifier``,
1101+
as well as whitespace immediatelly following ``f_debug_specifier``,
1102+
is retained as part of the expression.
1103+
1104+
.. impl-detail::
1105+
1106+
The expression is not handled in the tokenization phase; it is
1107+
retrieved from the source code using locations of the ``{`` token
1108+
and the token after ``=``.
11031109

11041110
.. grammar-snippet:: python-grammar
11051111
:group: python-grammar

0 commit comments

Comments
 (0)