Skip to content

Commit 10e2e80

Browse files
authored
Merge branch 'main' into 3.14-zstd-c-code
2 parents 8fdc7f7 + 3e256b9 commit 10e2e80

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

Doc/whatsnew/3.14.rst

+30
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)