@@ -71,7 +71,12 @@ Summary -- release highlights
7171* :ref: `PEP 761: Discontinuation of PGP signatures <whatsnew314-pep761 >`
7272* :ref: `PEP 765: Disallow return/break/continue that exit a finally block <whatsnew314-pep765 >`
7373* :ref: `PEP 768: Safe external debugger interface for CPython <whatsnew314-pep768 >`
74- * :ref: `A new type of interpreter <whatsnew314-tail-call >`
74+ * :ref: `A new type of interpreter <whatsnew314-tail-call >`
75+ * :ref: `Syntax highlighting in PyREPL <whatsnew314-pyrepl-highlighting >`,
76+ and color output in :ref: `unittest <whatsnew314-color-unittest >`,
77+ :ref: `argparse <whatsnew314-color-argparse >`,
78+ :ref: `json <whatsnew314-color-json >` and
79+ :ref: `calendar <whatsnew314-color-calendar >` CLIs
7580
7681
7782Incompatible changes
@@ -474,6 +479,36 @@ Improved error messages
474479 Traceback (most recent call last):
475480 SyntaxError : invalid syntax. Is this intended to be part of the string?
476481
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+
477512
478513 .. _whatsnew314-pep741 :
479514
@@ -560,6 +595,9 @@ For further information on how to build Python, see
560595(Contributed by Ken Jin in :gh: `128563 `, with ideas on how to implement this
561596in CPython by Mark Shannon, Garrett Gu, Haoran Xu, and Josh Haberman.)
562597
598+
599+ .. _whatsnew314-pyrepl-highlighting :
600+
563601Syntax highlighting in PyREPL
564602-----------------------------
565603
@@ -624,6 +662,11 @@ Other language changes
624662 ASCII :class: `bytes ` and :term: `bytes-like objects <bytes-like object> `.
625663 (Contributed by Daniel Pope in :gh: `129349 `.)
626664
665+ * Support ``\z `` as a synonym for ``\Z `` in :mod: `regular expressions <re> `.
666+ It is interpreted unambiguously in many other regular expression engines,
667+ unlike ``\Z ``, which has subtly different behavior.
668+ (Contributed by Serhiy Storchaka in :gh: `133306 `.)
669+
627670* ``\B `` in :mod: `regular expression <re> ` now matches empty input string.
628671 Now it is always the opposite of ``\b ``.
629672 (Contributed by Serhiy Storchaka in :gh: `124130 `.)
@@ -698,6 +741,17 @@ argparse
698741 and subparser names if mistyped by the user.
699742 (Contributed by Savannah Ostrowski in :gh: `124456 `.)
700743
744+ .. _whatsnew314-color-argparse :
745+
746+ * Introduced the optional *color * parameter to
747+ :class: `argparse.ArgumentParser `, enabling color for help text.
748+ This can be controlled via the :envvar: `PYTHON_COLORS ` environment
749+ variable as well as the canonical |NO_COLOR |_
750+ and |FORCE_COLOR |_ environment variables.
751+ See also :ref: `using-on-controlling-color `.
752+ (Contributed by Hugo van Kemenade in :gh: `130645 `.)
753+
754+
701755ast
702756---
703757
723777* The :mod: `bdb ` module now supports the :mod: `sys.monitoring ` backend.
724778 (Contributed by Tian Gao in :gh: `124533 `.)
725779
780+
781+ .. _whatsnew314-color-calendar :
782+
726783calendar
727784--------
728785
@@ -1021,6 +1078,8 @@ json
10211078 See the :ref: `JSON command-line interface <json-commandline >` documentation.
10221079 (Contributed by Trey Hunner in :gh: `122873 `.)
10231080
1081+ .. _whatsnew314-color-json :
1082+
10241083* By default, the output of the :ref: `JSON command-line interface <json-commandline >`
10251084 is highlighted in color. This can be controlled via the
10261085 :envvar: `PYTHON_COLORS ` environment variable as well as the canonical
@@ -1467,6 +1526,8 @@ unicodedata
14671526* The Unicode database has been updated to Unicode 16.0.0.
14681527
14691528
1529+ .. _whatsnew314-color-unittest :
1530+
14701531unittest
14711532--------
14721533
0 commit comments