@@ -556,6 +556,8 @@ New Modules
556
556
(Contributed by Sebastian Rittau in :issue: `42012 `.)
557
557
558
558
559
+ .. _whatsnew311-improved-modules :
560
+
559
561
Improved Modules
560
562
================
561
563
@@ -1088,6 +1090,8 @@ fcntl
1088
1090
the ``FD_CLOEXEC `` flag in addition.
1089
1091
1090
1092
1093
+ .. _whatsnew311-optimizations :
1094
+
1091
1095
Optimizations
1092
1096
=============
1093
1097
@@ -1120,6 +1124,8 @@ Optimizations
1120
1124
faster than Python 3.10.
1121
1125
1122
1126
1127
+ .. _whatsnew311-faster-cpython :
1128
+
1123
1129
Faster CPython
1124
1130
==============
1125
1131
@@ -1132,11 +1138,16 @@ could be up to 10-60% faster.
1132
1138
This project focuses on two major areas in Python: faster startup and faster
1133
1139
runtime. Other optimizations not under this project are listed in `Optimizations `_.
1134
1140
1141
+
1142
+ .. _whatsnew311-faster-startup :
1143
+
1135
1144
Faster Startup
1136
1145
--------------
1137
1146
1147
+ .. _whatsnew311-faster-imports :
1148
+
1138
1149
Frozen imports / Static code objects
1139
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1150
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1140
1151
1141
1152
Python caches bytecode in the :ref: `__pycache__<tut-pycache> ` directory to
1142
1153
speed up module loading.
@@ -1161,11 +1172,16 @@ impact for short-running programs using Python.
1161
1172
(Contributed by Eric Snow, Guido van Rossum and Kumar Aditya in numerous issues.)
1162
1173
1163
1174
1175
+ .. _whatsnew311-faster-runtime :
1176
+
1164
1177
Faster Runtime
1165
1178
--------------
1166
1179
1180
+ .. _whatsnew311-lazy-python-frames :
1181
+
1167
1182
Cheaper, lazy Python frames
1168
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~
1183
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
1184
+
1169
1185
Python frames are created whenever Python calls a Python function. This frame
1170
1186
holds execution information. The following are new frame optimizations:
1171
1187
@@ -1182,10 +1198,13 @@ up significantly. We measured a 3-7% speedup in pyperformance.
1182
1198
1183
1199
(Contributed by Mark Shannon in :issue: `44590 `.)
1184
1200
1201
+
1185
1202
.. _inline-calls :
1203
+ .. _whatsnew311-inline-calls :
1186
1204
1187
1205
Inlined Python function calls
1188
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1206
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1207
+
1189
1208
During a Python function call, Python will call an evaluating C function to
1190
1209
interpret that function's code. This effectively limits pure Python recursion to
1191
1210
what's safe for the C stack.
@@ -1202,8 +1221,12 @@ We measured a 1-3% improvement in pyperformance.
1202
1221
1203
1222
(Contributed by Pablo Galindo and Mark Shannon in :issue: `45256 `.)
1204
1223
1224
+
1225
+ .. _whatsnew311-pep659 :
1226
+
1205
1227
PEP 659: Specializing Adaptive Interpreter
1206
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1228
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1229
+
1207
1230
:pep: `659 ` is one of the key parts of the faster CPython project. The general
1208
1231
idea is that while Python is a dynamic language, most code has regions where
1209
1232
objects 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.)
1285
1308
be sped up by :issue: `45947 `.
1286
1309
1287
1310
1311
+ .. _whatsnew311-faster-cpython-misc :
1312
+
1288
1313
Misc
1289
1314
----
1290
1315
@@ -1296,6 +1321,9 @@ Misc
1296
1321
time required for catching an exception by about 10%.
1297
1322
(Contributed by Irit Katriel in :issue: `45711 `.)
1298
1323
1324
+
1325
+ .. _whatsnew311-faster-cpython-faq :
1326
+
1299
1327
FAQ
1300
1328
---
1301
1329
@@ -1330,6 +1358,8 @@ FAQ
1330
1358
| A: No. We're still exploring other optimizations.
1331
1359
1332
1360
1361
+ .. _whatsnew311-faster-cpython-about :
1362
+
1333
1363
About
1334
1364
-----
1335
1365
@@ -1339,6 +1369,8 @@ funded by Bloomberg LP to work on the project part-time. Finally, many
1339
1369
contributors are volunteers from the community.
1340
1370
1341
1371
1372
+ .. _whatsnew311-bytecode-changes :
1373
+
1342
1374
CPython bytecode changes
1343
1375
========================
1344
1376
@@ -1395,9 +1427,17 @@ CPython bytecode changes
1395
1427
* :opcode: `RESUME ` has been added. It is a no-op. Performs internal tracing,
1396
1428
debugging and optimization checks.
1397
1429
1430
+
1431
+ .. _whatsnew311-deprecated :
1432
+ .. _whatsnew311-python-api-deprecated :
1433
+
1398
1434
Deprecated
1399
1435
==========
1400
1436
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
+
1401
1441
* Chaining :class: `classmethod ` descriptors (introduced in :issue: `19072 `)
1402
1442
is now deprecated. It can no longer be used to wrap other descriptors
1403
1443
such as :class: `property `. The core design of this feature was flawed
@@ -1536,13 +1576,17 @@ Deprecated
1536
1576
(Contributed by Serhiy Storchaka and Miro Hrončok in :gh: `92728 `.)
1537
1577
1538
1578
1579
+ .. _whatsnew311-pending-removal :
1580
+ .. _whatsnew311-python-api-pending-removal :
1581
+
1539
1582
Pending Removal in Python 3.12
1540
1583
==============================
1541
1584
1542
- The following APIs have been deprecated in earlier Python releases,
1585
+ The following Python APIs have been deprecated in earlier Python releases,
1543
1586
and will be removed in Python 3.12.
1544
1587
1545
- Python API:
1588
+ C APIs pending removal are
1589
+ :ref: `listed separately <whatsnew311-c-api-pending-removal >`.
1546
1590
1547
1591
* :class: `pkgutil.ImpImporter `
1548
1592
* :class: `pkgutil.ImpLoader `
@@ -1571,29 +1615,17 @@ Python API:
1571
1615
* :func: `sqlite3.OptimizedUnicode `
1572
1616
* :func: `sqlite3.enable_shared_cache `
1573
1617
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() `
1592
1618
1619
+ .. _whatsnew311-removed :
1620
+ .. _whatsnew311-python-api-removed :
1593
1621
1594
1622
Removed
1595
1623
=======
1596
1624
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
+
1597
1629
* :class: `smtpd.MailmanProxy ` is now removed as it is unusable without
1598
1630
an external module, ``mailman ``. (Contributed by Dong-hee Na in :issue: `35800 `.)
1599
1631
@@ -1686,15 +1718,18 @@ Removed
1686
1718
of ``Tools/scripts `` and is `being developed independently
1687
1719
<https://gitlab.com/warsaw/pynche/-/tree/main> `_ from the Python source tree.
1688
1720
1721
+
1722
+ .. _whatsnew311-porting :
1723
+ .. _whatsnew311-python-api-porting :
1724
+
1689
1725
Porting to Python 3.11
1690
1726
======================
1691
1727
1692
1728
This 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.
1694
1730
1695
-
1696
- Changes in the Python API
1697
- -------------------------
1731
+ Porting notes for the C API are
1732
+ :ref: `listed separately <whatsnew311-c-api-porting >`.
1698
1733
1699
1734
* Prohibited passing non-:class: `concurrent.futures.ThreadPoolExecutor `
1700
1735
executors to :meth: `loop.set_default_executor ` following a deprecation in
@@ -1743,6 +1778,9 @@ Changes in the Python API
1743
1778
as meaningless when read. To get the pointer to the object's dictionary call
1744
1779
:c:func: `PyObject_GenericGetDict ` instead.
1745
1780
1781
+
1782
+ .. _whatsnew311-build-changes :
1783
+
1746
1784
Build Changes
1747
1785
=============
1748
1786
@@ -1830,9 +1868,13 @@ Build Changes
1830
1868
(Contributed by Serhiy Storchaka in :issue: `46996 `.)
1831
1869
1832
1870
1871
+ .. _whatsnew311-c-api :
1872
+
1833
1873
C API Changes
1834
1874
=============
1835
1875
1876
+ .. _whatsnew311-c-api-new-features :
1877
+
1836
1878
New Features
1837
1879
------------
1838
1880
@@ -1896,6 +1938,9 @@ New Features
1896
1938
* Added the :c:member: `PyConfig.safe_path ` member.
1897
1939
(Contributed by Victor Stinner in :gh: `57684 `.)
1898
1940
1941
+
1942
+ .. _whatsnew311-c-api-porting :
1943
+
1899
1944
Porting to Python 3.11
1900
1945
----------------------
1901
1946
@@ -2193,6 +2238,9 @@ Porting to Python 3.11
2193
2238
paths and then modify them, finish initialization and use :c:func: `PySys_GetObject `
2194
2239
to retrieve :data: `sys.path ` as a Python list object and modify it directly.
2195
2240
2241
+
2242
+ .. _whatsnew311-c-api-deprecated :
2243
+
2196
2244
Deprecated
2197
2245
----------
2198
2246
@@ -2218,6 +2266,35 @@ Deprecated
2218
2266
* Deprecate the ``ob_shash `` member of the :c:type: `PyBytesObject `. Use :c:func: `PyObject_Hash ` instead.
2219
2267
(Contributed by Inada Naoki in :issue: `46864 `.)
2220
2268
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
+
2221
2298
Removed
2222
2299
-------
2223
2300
0 commit comments