New submission from Terry J. Reedy <[email protected]>:
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@python
components: Documentation
messages: 395208
nosy: ammar2, docs@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 <[email protected]>
<https://bugs.python.org/issue44322>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com