[New-bugs-announce] [issue44322] Document SyntaxError args and interpretation for f-string fields

Terry J. Reedy report at bugs.python.org
Sun Jun 6 14:08:02 EDT 2021


New submission from Terry J. Reedy <tjreedy at udel.edu>:

Document that SyntaxError args[1] is a tuple of the other attributes and how the meaning of the attributes is adjusted when the syntax error is in an f-string field replacement expression.  Also add compile() to the list of builtins that can raise SyntaxError.

PR to follow immediately.  I wrote most of the text so that it works for 3.9 and 3.10+, with the new end info.  In the example, the main part of the message changed from "invalid syntax" to "invalid syntax. Perhaps you forgot a comma?".  I hid that with '...' but each could be given in the respective versions.  args[1] changes from "('', 1, 4, '(a b)\n')" to "('', 1, 2, '(a b)\n', 1, 5)" and that will have to be changed in a 3.9 backport.

Spinoff from #43705.  I will create a separate issue for using this information in IDLE.

----------
assignee: docs at python
components: Documentation
messages: 395208
nosy: ammar2, docs at python, pablogsal, terry.reedy
priority: normal
severity: normal
stage: patch review
status: open
title: Document SyntaxError args and interpretation for f-string fields
versions: Python 3.10, Python 3.11, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44322>
_______________________________________


More information about the New-bugs-announce mailing list