| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -479,6 +479,36 @@ Improved error messages | |||
| 479 | 479 | Traceback (most recent call last): | |
| 480 | 480 | SyntaxError: invalid syntax. Is this intended to be part of the string? | |
| 481 | 481 | ||
| 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 | + | ||
| 482 | 512 | ||
| 483 | 513 | .. _whatsnew314-pep741: | |
| 484 | 514 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments