Author terry.reedy
Recipients ammar2, docs@python, pablogsal, terry.reedy
Date 2021-06-06.18:08:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1623002882.29.0.18089696259.issue44322@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-06-06 18:08:02terry.reedysetrecipients: + terry.reedy, docs@python, ammar2, pablogsal
2021-06-06 18:08:02terry.reedysetmessageid: <1623002882.29.0.18089696259.issue44322@roundup.psfhosted.org>
2021-06-06 18:08:02terry.reedylinkissue44322 messages
2021-06-06 18:08:01terry.reedycreate