@@ -556,6 +556,8 @@ New Modules
556556 (Contributed by Sebastian Rittau in :issue: `42012 `.)
557557
558558
559+ .. _whatsnew311-improved-modules :
560+
559561Improved Modules
560562================
561563
@@ -1088,6 +1090,8 @@ fcntl
10881090 the ``FD_CLOEXEC `` flag in addition.
10891091
10901092
1093+ .. _whatsnew311-optimizations :
1094+
10911095Optimizations
10921096=============
10931097
@@ -1120,6 +1124,8 @@ Optimizations
11201124 faster than Python 3.10.
11211125
11221126
1127+ .. _whatsnew311-faster-cpython :
1128+
11231129Faster CPython
11241130==============
11251131
@@ -1132,11 +1138,16 @@ could be up to 10-60% faster.
11321138This project focuses on two major areas in Python: faster startup and faster
11331139runtime. Other optimizations not under this project are listed in `Optimizations `_.
11341140
1141+
1142+ .. _whatsnew311-faster-startup :
1143+
11351144Faster Startup
11361145--------------
11371146
1147+ .. _whatsnew311-faster-imports :
1148+
11381149Frozen imports / Static code objects
1139- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1150+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11401151
11411152Python caches bytecode in the :ref: `__pycache__<tut-pycache> ` directory to
11421153speed up module loading.
@@ -1161,11 +1172,16 @@ impact for short-running programs using Python.
11611172(Contributed by Eric Snow, Guido van Rossum and Kumar Aditya in numerous issues.)
11621173
11631174
1175+ .. _whatsnew311-faster-runtime :
1176+
11641177Faster Runtime
11651178--------------
11661179
1180+ .. _whatsnew311-lazy-python-frames :
1181+
11671182Cheaper, lazy Python frames
1168- ~~~~~~~~~~~~~~~~~~~~~~~~~~~
1183+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
1184+
11691185Python frames are created whenever Python calls a Python function. This frame
11701186holds execution information. The following are new frame optimizations:
11711187
@@ -1182,10 +1198,13 @@ up significantly. We measured a 3-7% speedup in pyperformance.
11821198
11831199(Contributed by Mark Shannon in :issue: `44590 `.)
11841200
1201+
11851202.. _inline-calls :
1203+ .. _whatsnew311-inline-calls :
11861204
11871205Inlined Python function calls
1188- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1206+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1207+
11891208During a Python function call, Python will call an evaluating C function to
11901209interpret that function's code. This effectively limits pure Python recursion to
11911210what's safe for the C stack.
@@ -1202,8 +1221,12 @@ We measured a 1-3% improvement in pyperformance.
12021221
12031222(Contributed by Pablo Galindo and Mark Shannon in :issue: `45256 `.)
12041223
1224+
1225+ .. _whatsnew311-pep659 :
1226+
12051227PEP 659: Specializing Adaptive Interpreter
1206- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1228+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1229+
12071230:pep: `659 ` is one of the key parts of the faster CPython project. The general
12081231idea is that while Python is a dynamic language, most code has regions where
12091232objects and types rarely change. This concept is known as *type stability *.
@@ -1285,6 +1308,8 @@ Bucher, with additional help from Irit Katriel and Dennis Sweeney.)
12851308 be sped up by :issue: `45947 `.
12861309
12871310
1311+ .. _whatsnew311-faster-cpython-misc :
1312+
12881313Misc
12891314----
12901315
@@ -1296,6 +1321,9 @@ Misc
12961321 time required for catching an exception by about 10%.
12971322 (Contributed by Irit Katriel in :issue: `45711 `.)
12981323
1324+
1325+ .. _whatsnew311-faster-cpython-faq :
1326+
12991327FAQ
13001328---
13011329
@@ -1330,6 +1358,8 @@ FAQ
13301358| A: No. We're still exploring other optimizations.
13311359
13321360
1361+ .. _whatsnew311-faster-cpython-about :
1362+
13331363About
13341364-----
13351365
@@ -1339,6 +1369,8 @@ funded by Bloomberg LP to work on the project part-time. Finally, many
13391369contributors are volunteers from the community.
13401370
13411371
1372+ .. _whatsnew311-bytecode-changes :
1373+
13421374CPython bytecode changes
13431375========================
13441376
@@ -1395,9 +1427,17 @@ CPython bytecode changes
13951427* :opcode: `RESUME ` has been added. It is a no-op. Performs internal tracing,
13961428 debugging and optimization checks.
13971429
1430+
1431+ .. _whatsnew311-deprecated :
1432+ .. _whatsnew311-python-api-deprecated :
1433+
13981434Deprecated
13991435==========
14001436
1437+ This section lists Python APIs that have been deprecated in Python 3.11.
1438+
1439+ Deprecated C APIs are :ref: `listed separately <whatsnew311-c-api-deprecated >`.
1440+
14011441* Chaining :class: `classmethod ` descriptors (introduced in :issue: `19072 `)
14021442 is now deprecated. It can no longer be used to wrap other descriptors
14031443 such as :class: `property `. The core design of this feature was flawed
@@ -1536,13 +1576,17 @@ Deprecated
15361576 (Contributed by Serhiy Storchaka and Miro Hrončok in :gh: `92728 `.)
15371577
15381578
1579+ .. _whatsnew311-pending-removal :
1580+ .. _whatsnew311-python-api-pending-removal :
1581+
15391582Pending Removal in Python 3.12
15401583==============================
15411584
1542- The following APIs have been deprecated in earlier Python releases,
1585+ The following Python APIs have been deprecated in earlier Python releases,
15431586and will be removed in Python 3.12.
15441587
1545- Python API:
1588+ C APIs pending removal are
1589+ :ref: `listed separately <whatsnew311-c-api-pending-removal >`.
15461590
15471591* :class: `pkgutil.ImpImporter `
15481592* :class: `pkgutil.ImpLoader `
@@ -1571,29 +1615,17 @@ Python API:
15711615* :func: `sqlite3.OptimizedUnicode `
15721616* :func: `sqlite3.enable_shared_cache `
15731617
1574- C API:
1575-
1576- * :c:func: `PyUnicode_AS_DATA `
1577- * :c:func: `PyUnicode_AS_UNICODE `
1578- * :c:func: `PyUnicode_AsUnicodeAndSize `
1579- * :c:func: `PyUnicode_AsUnicode `
1580- * :c:func: `PyUnicode_FromUnicode `
1581- * :c:func: `PyUnicode_GET_DATA_SIZE `
1582- * :c:func: `PyUnicode_GET_SIZE `
1583- * :c:func: `PyUnicode_GetSize `
1584- * :c:func: `PyUnicode_IS_COMPACT `
1585- * :c:func: `PyUnicode_IS_READY `
1586- * :c:func: `PyUnicode_READY `
1587- * :c:func: `Py_UNICODE_WSTR_LENGTH `
1588- * :c:func: `_PyUnicode_AsUnicode `
1589- * :c:macro: `PyUnicode_WCHAR_KIND `
1590- * :c:type: `PyUnicodeObject `
1591- * :c:func: `PyUnicode_InternImmortal() `
15921618
1619+ .. _whatsnew311-removed :
1620+ .. _whatsnew311-python-api-removed :
15931621
15941622Removed
15951623=======
15961624
1625+ This section lists Python APIs that have been removed in Python 3.12.
1626+
1627+ Removed C APIs are :ref: `listed separately <whatsnew311-c-api-removed >`.
1628+
15971629* :class: `smtpd.MailmanProxy ` is now removed as it is unusable without
15981630 an external module, ``mailman ``. (Contributed by Dong-hee Na in :issue: `35800 `.)
15991631
@@ -1686,15 +1718,18 @@ Removed
16861718 of ``Tools/scripts `` and is `being developed independently
16871719 <https://gitlab.com/warsaw/pynche/-/tree/main> `_ from the Python source tree.
16881720
1721+
1722+ .. _whatsnew311-porting :
1723+ .. _whatsnew311-python-api-porting :
1724+
16891725Porting to Python 3.11
16901726======================
16911727
16921728This section lists previously described changes and other bugfixes
1693- that may require changes to your code.
1729+ in the Python API that may require changes to your Python code.
16941730
1695-
1696- Changes in the Python API
1697- -------------------------
1731+ Porting notes for the C API are
1732+ :ref: `listed separately <whatsnew311-c-api-porting >`.
16981733
16991734* Prohibited passing non-:class: `concurrent.futures.ThreadPoolExecutor `
17001735 executors to :meth: `loop.set_default_executor ` following a deprecation in
@@ -1743,6 +1778,9 @@ Changes in the Python API
17431778 as meaningless when read. To get the pointer to the object's dictionary call
17441779 :c:func: `PyObject_GenericGetDict ` instead.
17451780
1781+
1782+ .. _whatsnew311-build-changes :
1783+
17461784Build Changes
17471785=============
17481786
@@ -1830,9 +1868,13 @@ Build Changes
18301868 (Contributed by Serhiy Storchaka in :issue: `46996 `.)
18311869
18321870
1871+ .. _whatsnew311-c-api :
1872+
18331873C API Changes
18341874=============
18351875
1876+ .. _whatsnew311-c-api-new-features :
1877+
18361878New Features
18371879------------
18381880
@@ -1896,6 +1938,9 @@ New Features
18961938* Added the :c:member: `PyConfig.safe_path ` member.
18971939 (Contributed by Victor Stinner in :gh: `57684 `.)
18981940
1941+
1942+ .. _whatsnew311-c-api-porting :
1943+
18991944Porting to Python 3.11
19001945----------------------
19011946
@@ -2193,6 +2238,9 @@ Porting to Python 3.11
21932238 paths and then modify them, finish initialization and use :c:func: `PySys_GetObject `
21942239 to retrieve :data: `sys.path ` as a Python list object and modify it directly.
21952240
2241+
2242+ .. _whatsnew311-c-api-deprecated :
2243+
21962244Deprecated
21972245----------
21982246
@@ -2218,6 +2266,35 @@ Deprecated
22182266* Deprecate the ``ob_shash `` member of the :c:type: `PyBytesObject `. Use :c:func: `PyObject_Hash ` instead.
22192267 (Contributed by Inada Naoki in :issue: `46864 `.)
22202268
2269+
2270+ .. _whatsnew311-c-api-pending-removal :
2271+
2272+ Pending Removal in Python 3.12
2273+ ------------------------------
2274+
2275+ The following C APIs have been deprecated in earlier Python releases,
2276+ and will be removed in Python 3.12.
2277+
2278+ * :c:func: `PyUnicode_AS_DATA `
2279+ * :c:func: `PyUnicode_AS_UNICODE `
2280+ * :c:func: `PyUnicode_AsUnicodeAndSize `
2281+ * :c:func: `PyUnicode_AsUnicode `
2282+ * :c:func: `PyUnicode_FromUnicode `
2283+ * :c:func: `PyUnicode_GET_DATA_SIZE `
2284+ * :c:func: `PyUnicode_GET_SIZE `
2285+ * :c:func: `PyUnicode_GetSize `
2286+ * :c:func: `PyUnicode_IS_COMPACT `
2287+ * :c:func: `PyUnicode_IS_READY `
2288+ * :c:func: `PyUnicode_READY `
2289+ * :c:func: `Py_UNICODE_WSTR_LENGTH `
2290+ * :c:func: `_PyUnicode_AsUnicode `
2291+ * :c:macro: `PyUnicode_WCHAR_KIND `
2292+ * :c:type: `PyUnicodeObject `
2293+ * :c:func: `PyUnicode_InternImmortal() `
2294+
2295+
2296+ .. _whatsnew311-c-api-removed :
2297+
22212298Removed
22222299-------
22232300
0 commit comments