@@ -74,10 +74,10 @@ New typing features:
74
74
75
75
* :pep: `688 `: Making the buffer protocol accessible in Python
76
76
77
- * :ref: `whatsnew312-pep695 `
78
-
79
77
* :ref: `whatsnew312-pep692 `
80
78
79
+ * :ref: `whatsnew312-pep695 `
80
+
81
81
* :pep: `698 `: Override Decorator for Static Typing
82
82
83
83
Important deprecations, removals or restrictions:
@@ -179,7 +179,7 @@ same quote as the containing f-string. Let's cover these in detail:
179
179
must be defined in a single line even if outside f-strings expressions could
180
180
span multiple lines (like literal lists being defined over multiple lines),
181
181
making them harder to read. In Python 3.12 you can now define expressions
182
- spaning multiple lines and include comments on them:
182
+ spanning multiple lines and include comments on them:
183
183
184
184
>>> f " This is the playlist: { " , " .join([
185
185
... ' Take me back to Eden' , # My, my, those eyes like fire
@@ -216,7 +216,7 @@ f-string raises a :exc:`SyntaxError`:
216
216
^^^
217
217
SyntaxError : f- string: invalid syntax. Perhaps you forgot a comma?
218
218
219
- but the error message doesn't include the exact location of the error withing the line and
219
+ but the error message doesn't include the exact location of the error within the line and
220
220
also has the expression artificially surrounded by parentheses. In Python 3.12, as f-strings
221
221
are parsed with the PEG parser, error messages can be more precise and show the entire line:
222
222
553
553
provide finer grained control of ``None `` and empty strings by
554
554
:class: `~csv.writer ` objects.
555
555
556
- inspect
557
- -------
558
-
559
- * Add :func: `inspect.markcoroutinefunction ` to mark sync functions that return
560
- a :term: `coroutine ` for use with :func: `inspect.iscoroutinefunction `.
561
- (Contributed Carlton Gibson in :gh: `99247 `.)
562
-
563
- * Add :func: `inspect.getasyncgenstate ` and :func: `inspect.getasyncgenlocals `
564
- for determining the current state of asynchronous generators.
565
- (Contributed by Thomas Krennwallner in :issue: `35759 `.)
566
-
567
- * The performance of :func: `inspect.getattr_static ` has been considerably
568
- improved. Most calls to the function should be at least 2x faster than they
569
- were in Python 3.11, and some may be 6x faster or more. (Contributed by Alex
570
- Waygood in :gh: `103193 `.)
571
-
572
- pathlib
573
- -------
574
-
575
- * Add support for subclassing :class: `pathlib.PurePath ` and
576
- :class: `~pathlib.Path `, plus their Posix- and Windows-specific variants.
577
- Subclasses may override the :meth: `~pathlib.PurePath.with_segments ` method
578
- to pass information between path instances.
579
-
580
- * Add :meth: `~pathlib.Path.walk ` for walking the directory trees and generating
581
- all file or directory names within them, similar to :func: `os.walk `.
582
- (Contributed by Stanislav Zmiev in :gh: `90385 `.)
583
-
584
- * Add *walk_up * optional parameter to :meth: `pathlib.PurePath.relative_to `
585
- to allow the insertion of ``.. `` entries in the result; this behavior is
586
- more consistent with :func: `os.path.relpath `.
587
- (Contributed by Domenico Ragusa in :issue: `40358 `.)
588
-
589
- * Add :meth: `pathlib.Path.is_junction ` as a proxy to :func: `os.path.isjunction `.
590
- (Contributed by Charles Machalow in :gh: `99547 `.)
591
-
592
- * Add *case_sensitive * optional parameter to :meth: `pathlib.Path.glob `,
593
- :meth: `pathlib.Path.rglob ` and :meth: `pathlib.PurePath.match ` for matching
594
- the path's case sensitivity, allowing for more precise control over the matching process.
595
-
596
556
dis
597
557
---
598
558
@@ -610,6 +570,22 @@ fractions
610
570
* Objects of type :class: `fractions.Fraction ` now support float-style
611
571
formatting. (Contributed by Mark Dickinson in :gh: `100161 `.)
612
572
573
+ inspect
574
+ -------
575
+
576
+ * Add :func: `inspect.markcoroutinefunction ` to mark sync functions that return
577
+ a :term: `coroutine ` for use with :func: `inspect.iscoroutinefunction `.
578
+ (Contributed Carlton Gibson in :gh: `99247 `.)
579
+
580
+ * Add :func: `inspect.getasyncgenstate ` and :func: `inspect.getasyncgenlocals `
581
+ for determining the current state of asynchronous generators.
582
+ (Contributed by Thomas Krennwallner in :issue: `35759 `.)
583
+
584
+ * The performance of :func: `inspect.getattr_static ` has been considerably
585
+ improved. Most calls to the function should be at least 2x faster than they
586
+ were in Python 3.11, and some may be 6x faster or more. (Contributed by Alex
587
+ Waygood in :gh: `103193 `.)
588
+
613
589
itertools
614
590
---------
615
591
@@ -669,6 +645,30 @@ os.path
669
645
* Add :func: `os.path.splitroot ` to split a path into a triad
670
646
``(drive, root, tail) ``. (Contributed by Barney Gale in :gh: `101000 `.)
671
647
648
+ pathlib
649
+ -------
650
+
651
+ * Add support for subclassing :class: `pathlib.PurePath ` and
652
+ :class: `~pathlib.Path `, plus their Posix- and Windows-specific variants.
653
+ Subclasses may override the :meth: `~pathlib.PurePath.with_segments ` method
654
+ to pass information between path instances.
655
+
656
+ * Add :meth: `~pathlib.Path.walk ` for walking the directory trees and generating
657
+ all file or directory names within them, similar to :func: `os.walk `.
658
+ (Contributed by Stanislav Zmiev in :gh: `90385 `.)
659
+
660
+ * Add *walk_up * optional parameter to :meth: `pathlib.PurePath.relative_to `
661
+ to allow the insertion of ``.. `` entries in the result; this behavior is
662
+ more consistent with :func: `os.path.relpath `.
663
+ (Contributed by Domenico Ragusa in :issue: `40358 `.)
664
+
665
+ * Add :meth: `pathlib.Path.is_junction ` as a proxy to :func: `os.path.isjunction `.
666
+ (Contributed by Charles Machalow in :gh: `99547 `.)
667
+
668
+ * Add *case_sensitive * optional parameter to :meth: `pathlib.Path.glob `,
669
+ :meth: `pathlib.Path.rglob ` and :meth: `pathlib.PurePath.match ` for matching
670
+ the path's case sensitivity, allowing for more precise control over the matching process.
671
+
672
672
pdb
673
673
---
674
674
@@ -746,6 +746,38 @@ statistics
746
746
for computing the Spearman correlation of ranked data.
747
747
(Contributed by Raymond Hettinger in :gh: `95861 `.)
748
748
749
+ sys
750
+ ---
751
+
752
+ * Add :func: `sys.activate_stack_trampoline ` and
753
+ :func: `sys.deactivate_stack_trampoline ` for activating and deactivating
754
+ stack profiler trampolines,
755
+ and :func: `sys.is_stack_trampoline_active ` for querying if stack profiler
756
+ trampolines are active.
757
+ (Contributed by Pablo Galindo and Christian Heimes
758
+ with contributions from Gregory P. Smith [Google] and Mark Shannon
759
+ in :gh: `96123 `.)
760
+
761
+ * Add :data: `sys.last_exc ` which holds the last unhandled exception that
762
+ was raised (for post-mortem debugging use cases). Deprecate the
763
+ three fields that have the same information in its legacy form:
764
+ :data: `sys.last_type `, :data: `sys.last_value ` and :data: `sys.last_traceback `.
765
+ (Contributed by Irit Katriel in :gh: `102778 `.)
766
+
767
+ * :func: `sys._current_exceptions ` now returns a mapping from thread-id to an
768
+ exception instance, rather than to a ``(typ, exc, tb) `` tuple.
769
+ (Contributed by Irit Katriel in :gh: `103176 `.)
770
+
771
+ tempfile
772
+ --------
773
+
774
+ * The :class: `tempfile.NamedTemporaryFile ` function has a new optional parameter
775
+ *delete_on_close * (Contributed by Evgeny Zorin in :gh: `58451 `.)
776
+ * :func: `tempfile.mkdtemp ` now always returns an absolute path, even if the
777
+ argument provided to the *dir * parameter is a relative path.
778
+
779
+ .. _whatsnew-typing-py312 :
780
+
749
781
threading
750
782
---------
751
783
@@ -780,49 +812,6 @@ types
780
812
:ref: `user-defined-generics ` when subclassed. (Contributed by
781
813
James Hilton-Balfe and Alex Waygood in :gh: `101827 `.)
782
814
783
- unicodedata
784
- -----------
785
-
786
- * The Unicode database has been updated to version 15.0.0. (Contributed by
787
- Benjamin Peterson in :gh: `96734 `).
788
-
789
- unittest
790
- --------
791
-
792
- Added ``--durations `` command line option, showing the N slowest test cases::
793
-
794
- python3 -m unittest --durations=3 lib.tests.test_threading
795
- .....
796
- Slowest test durations
797
- ----------------------------------------------------------------------
798
- 1.210s test_timeout (Lib.test.test_threading.BarrierTests)
799
- 1.003s test_default_timeout (Lib.test.test_threading.BarrierTests)
800
- 0.518s test_timeout (Lib.test.test_threading.EventTests)
801
-
802
- (0.000 durations hidden. Use -v to show these durations.)
803
- ----------------------------------------------------------------------
804
- Ran 158 tests in 9.869s
805
-
806
- OK (skipped=3)
807
-
808
- (Contributed by Giampaolo Rodola in :issue: `4080 `)
809
-
810
- uuid
811
- ----
812
-
813
- * Add a :ref: `command-line interface <uuid-cli >`.
814
- (Contributed by Adam Chhina in :gh: `88597 `.)
815
-
816
- tempfile
817
- --------
818
-
819
- * The :class: `tempfile.NamedTemporaryFile ` function has a new optional parameter
820
- *delete_on_close * (Contributed by Evgeny Zorin in :gh: `58451 `.)
821
- * :func: `tempfile.mkdtemp ` now always returns an absolute path, even if the
822
- argument provided to the *dir * parameter is a relative path.
823
-
824
- .. _whatsnew-typing-py312 :
825
-
826
815
typing
827
816
------
828
817
@@ -877,27 +866,38 @@ typing
877
866
* Add ``frozen_default `` parameter to :func: `typing.dataclass_transform `.
878
867
(Contributed by Erik De Bonte in :gh: `99957 `.)
879
868
880
- sys
881
- ---
869
+ unicodedata
870
+ -----------
882
871
883
- * Add :func: `sys.activate_stack_trampoline ` and
884
- :func: `sys.deactivate_stack_trampoline ` for activating and deactivating
885
- stack profiler trampolines,
886
- and :func: `sys.is_stack_trampoline_active ` for querying if stack profiler
887
- trampolines are active.
888
- (Contributed by Pablo Galindo and Christian Heimes
889
- with contributions from Gregory P. Smith [Google] and Mark Shannon
890
- in :gh: `96123 `.)
872
+ * The Unicode database has been updated to version 15.0.0. (Contributed by
873
+ Benjamin Peterson in :gh: `96734 `).
891
874
892
- * Add :data: `sys.last_exc ` which holds the last unhandled exception that
893
- was raised (for post-mortem debugging use cases). Deprecate the
894
- three fields that have the same information in its legacy form:
895
- :data: `sys.last_type `, :data: `sys.last_value ` and :data: `sys.last_traceback `.
896
- (Contributed by Irit Katriel in :gh: `102778 `.)
875
+ unittest
876
+ --------
897
877
898
- * :func: `sys._current_exceptions ` now returns a mapping from thread-id to an
899
- exception instance, rather than to a ``(typ, exc, tb) `` tuple.
900
- (Contributed by Irit Katriel in :gh: `103176 `.)
878
+ Added ``--durations `` command line option, showing the N slowest test cases::
879
+
880
+ python3 -m unittest --durations=3 lib.tests.test_threading
881
+ .....
882
+ Slowest test durations
883
+ ----------------------------------------------------------------------
884
+ 1.210s test_timeout (Lib.test.test_threading.BarrierTests)
885
+ 1.003s test_default_timeout (Lib.test.test_threading.BarrierTests)
886
+ 0.518s test_timeout (Lib.test.test_threading.EventTests)
887
+
888
+ (0.000 durations hidden. Use -v to show these durations.)
889
+ ----------------------------------------------------------------------
890
+ Ran 158 tests in 9.869s
891
+
892
+ OK (skipped=3)
893
+
894
+ (Contributed by Giampaolo Rodola in :issue: `4080 `)
895
+
896
+ uuid
897
+ ----
898
+
899
+ * Add a :ref: `command-line interface <uuid-cli >`.
900
+ (Contributed by Adam Chhina in :gh: `88597 `.)
901
901
902
902
903
903
Optimizations
@@ -1486,7 +1486,7 @@ Changes in the Python API
1486
1486
1,13-1,17: FSTRING_MIDDLE ' end'
1487
1487
1,17-1,18: FSTRING_END '"'
1488
1488
1489
- Aditionally , there may be some minor behavioral changes as a consecuence of the
1489
+ Additionally , there may be some minor behavioral changes as a consecuence of the
1490
1490
changes required to support :pep: `701 `. Some of these changes include:
1491
1491
1492
1492
* Some final ``DEDENT `` tokens are now emitted within the bounds of the
@@ -1757,7 +1757,7 @@ Porting to Python 3.12
1757
1757
before storing it. (Contributed by Mark Shannon in :gh: `101578 `.)
1758
1758
1759
1759
* ``_Py_RefTotal `` is no longer authoritative and only kept around
1760
- for ABI compabitility . Note that it is an internal global and only
1760
+ for ABI compatibility . Note that it is an internal global and only
1761
1761
available on debug builds. If you happen to be using it then you'll
1762
1762
need to start using ``_Py_GetGlobalRefTotal() ``.
1763
1763
0 commit comments