File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -479,6 +479,36 @@ Improved error messages
479479 Traceback (most recent call last):
480480 SyntaxError : invalid syntax. Is this intended to be part of the string?
481481
482+ * When strings have incompatible prefixes, the error now shows
483+ which prefixes are incompatible. (Contributed by
484+ Nikita Sobolev in :gh: `133197 `.)
485+
486+ .. code-block :: pycon
487+
488+ >>> ub'abc'
489+ File "<python-input-0>", line 1
490+ ub'abc'
491+ ^^
492+ SyntaxError: 'u' and 'b' prefixes are incompatible
493+
494+ * Improved error messages when using ``as `` with incompatible targets in:
495+
496+ - Imports: ``import ... as ... ``
497+ - From imports: ``from ... import ... as ... ``
498+ - Except handlers: ``except ... as ... ``
499+ - Pattern-match cases: ``case ... as ... ``
500+
501+ (Contributed by Nikita Sobolev in :gh: `123539 `,
502+ :gh: `123562 `, and :gh: `123440 `.)
503+
504+ .. code-block :: pycon
505+
506+ >>> import ast as arr[0]
507+ File "<python-input-1>", line 1
508+ import ast as arr[0]
509+ ^^^^^^
510+ SyntaxError: cannot use subscript as import target
511+
482512
483513 .. _whatsnew314-pep741 :
484514
You can’t perform that action at this time.
0 commit comments