@@ -561,6 +561,8 @@ New Modules
561
561
(Contributed by Sebastian Rittau in :issue: `42012 `.)
562
562
563
563
564
+ .. _whatsnew311-improved-modules :
565
+
564
566
Improved Modules
565
567
================
566
568
@@ -1093,6 +1095,8 @@ fcntl
1093
1095
the ``FD_CLOEXEC `` flag in addition.
1094
1096
1095
1097
1098
+ .. _whatsnew311-optimizations :
1099
+
1096
1100
Optimizations
1097
1101
=============
1098
1102
@@ -1144,6 +1148,8 @@ This section covers specific optimizations independent of the
1144
1148
(Contributed by Dong-hee Na in :issue: `44987 `.)
1145
1149
1146
1150
1151
+ .. _whatsnew311-faster-cpython :
1152
+
1147
1153
Faster CPython
1148
1154
==============
1149
1155
@@ -1156,11 +1162,16 @@ could be up to 10-60% faster.
1156
1162
This project focuses on two major areas in Python: faster startup and faster
1157
1163
runtime. Other optimizations not under this project are listed in `Optimizations `_.
1158
1164
1165
+
1166
+ .. _whatsnew311-faster-startup :
1167
+
1159
1168
Faster Startup
1160
1169
--------------
1161
1170
1171
+ .. _whatsnew311-faster-imports :
1172
+
1162
1173
Frozen imports / Static code objects
1163
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1174
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1164
1175
1165
1176
Python caches bytecode in the :ref: `__pycache__<tut-pycache> ` directory to
1166
1177
speed up module loading.
@@ -1185,11 +1196,16 @@ impact for short-running programs using Python.
1185
1196
(Contributed by Eric Snow, Guido van Rossum and Kumar Aditya in numerous issues.)
1186
1197
1187
1198
1199
+ .. _whatsnew311-faster-runtime :
1200
+
1188
1201
Faster Runtime
1189
1202
--------------
1190
1203
1204
+ .. _whatsnew311-lazy-python-frames :
1205
+
1191
1206
Cheaper, lazy Python frames
1192
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~
1207
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
1208
+
1193
1209
Python frames are created whenever Python calls a Python function. This frame
1194
1210
holds execution information. The following are new frame optimizations:
1195
1211
@@ -1206,10 +1222,13 @@ up significantly. We measured a 3-7% speedup in pyperformance.
1206
1222
1207
1223
(Contributed by Mark Shannon in :issue: `44590 `.)
1208
1224
1225
+
1209
1226
.. _inline-calls :
1227
+ .. _whatsnew311-inline-calls :
1210
1228
1211
1229
Inlined Python function calls
1212
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1230
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1231
+
1213
1232
During a Python function call, Python will call an evaluating C function to
1214
1233
interpret that function's code. This effectively limits pure Python recursion to
1215
1234
what's safe for the C stack.
@@ -1226,8 +1245,12 @@ We measured a 1-3% improvement in pyperformance.
1226
1245
1227
1246
(Contributed by Pablo Galindo and Mark Shannon in :issue: `45256 `.)
1228
1247
1248
+
1249
+ .. _whatsnew311-pep659 :
1250
+
1229
1251
PEP 659: Specializing Adaptive Interpreter
1230
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1252
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1253
+
1231
1254
:pep: `659 ` is one of the key parts of the faster CPython project. The general
1232
1255
idea is that while Python is a dynamic language, most code has regions where
1233
1256
objects and types rarely change. This concept is known as *type stability *.
@@ -1309,6 +1332,8 @@ Bucher, with additional help from Irit Katriel and Dennis Sweeney.)
1309
1332
be sped up by :issue: `45947 `.
1310
1333
1311
1334
1335
+ .. _whatsnew311-faster-cpython-misc :
1336
+
1312
1337
Misc
1313
1338
----
1314
1339
@@ -1320,6 +1345,9 @@ Misc
1320
1345
time required for catching an exception by about 10%.
1321
1346
(Contributed by Irit Katriel in :issue: `45711 `.)
1322
1347
1348
+
1349
+ .. _whatsnew311-faster-cpython-faq :
1350
+
1323
1351
FAQ
1324
1352
---
1325
1353
@@ -1354,6 +1382,8 @@ FAQ
1354
1382
| A: No. We're still exploring other optimizations.
1355
1383
1356
1384
1385
+ .. _whatsnew311-faster-cpython-about :
1386
+
1357
1387
About
1358
1388
-----
1359
1389
@@ -1363,6 +1393,8 @@ funded by Bloomberg LP to work on the project part-time. Finally, many
1363
1393
contributors are volunteers from the community.
1364
1394
1365
1395
1396
+ .. _whatsnew311-bytecode-changes :
1397
+
1366
1398
CPython bytecode changes
1367
1399
========================
1368
1400
@@ -1419,9 +1451,17 @@ CPython bytecode changes
1419
1451
* :opcode: `RESUME ` has been added. It is a no-op. Performs internal tracing,
1420
1452
debugging and optimization checks.
1421
1453
1454
+
1455
+ .. _whatsnew311-deprecated :
1456
+ .. _whatsnew311-python-api-deprecated :
1457
+
1422
1458
Deprecated
1423
1459
==========
1424
1460
1461
+ This section lists Python APIs that have been deprecated in Python 3.11.
1462
+
1463
+ Deprecated C APIs are :ref: `listed separately <whatsnew311-c-api-deprecated >`.
1464
+
1425
1465
* Chaining :class: `classmethod ` descriptors (introduced in :issue: `19072 `)
1426
1466
is now deprecated. It can no longer be used to wrap other descriptors
1427
1467
such as :class: `property `. The core design of this feature was flawed
@@ -1561,13 +1601,17 @@ Deprecated
1561
1601
(Contributed by Serhiy Storchaka and Miro Hrončok in :gh: `92728 `.)
1562
1602
1563
1603
1604
+ .. _whatsnew311-pending-removal :
1605
+ .. _whatsnew311-python-api-pending-removal :
1606
+
1564
1607
Pending Removal in Python 3.12
1565
1608
==============================
1566
1609
1567
- The following APIs have been deprecated in earlier Python releases,
1610
+ The following Python APIs have been deprecated in earlier Python releases,
1568
1611
and will be removed in Python 3.12.
1569
1612
1570
- Python API:
1613
+ C APIs pending removal are
1614
+ :ref: `listed separately <whatsnew311-c-api-pending-removal >`.
1571
1615
1572
1616
* :class: `pkgutil.ImpImporter `
1573
1617
* :class: `pkgutil.ImpLoader `
@@ -1596,29 +1640,17 @@ Python API:
1596
1640
* :func: `sqlite3.OptimizedUnicode `
1597
1641
* :func: `sqlite3.enable_shared_cache `
1598
1642
1599
- C API:
1600
-
1601
- * :c:func: `PyUnicode_AS_DATA `
1602
- * :c:func: `PyUnicode_AS_UNICODE `
1603
- * :c:func: `PyUnicode_AsUnicodeAndSize `
1604
- * :c:func: `PyUnicode_AsUnicode `
1605
- * :c:func: `PyUnicode_FromUnicode `
1606
- * :c:func: `PyUnicode_GET_DATA_SIZE `
1607
- * :c:func: `PyUnicode_GET_SIZE `
1608
- * :c:func: `PyUnicode_GetSize `
1609
- * :c:func: `PyUnicode_IS_COMPACT `
1610
- * :c:func: `PyUnicode_IS_READY `
1611
- * :c:func: `PyUnicode_READY `
1612
- * :c:func: `Py_UNICODE_WSTR_LENGTH `
1613
- * :c:func: `_PyUnicode_AsUnicode `
1614
- * :c:macro: `PyUnicode_WCHAR_KIND `
1615
- * :c:type: `PyUnicodeObject `
1616
- * :c:func: `PyUnicode_InternImmortal() `
1617
1643
1644
+ .. _whatsnew311-removed :
1645
+ .. _whatsnew311-python-api-removed :
1618
1646
1619
1647
Removed
1620
1648
=======
1621
1649
1650
+ This section lists Python APIs that have been removed in Python 3.12.
1651
+
1652
+ Removed C APIs are :ref: `listed separately <whatsnew311-c-api-removed >`.
1653
+
1622
1654
* :class: `smtpd.MailmanProxy ` is now removed as it is unusable without
1623
1655
an external module, ``mailman ``. (Contributed by Dong-hee Na in :issue: `35800 `.)
1624
1656
@@ -1711,15 +1743,18 @@ Removed
1711
1743
of ``Tools/scripts `` and is `being developed independently
1712
1744
<https://gitlab.com/warsaw/pynche/-/tree/main> `_ from the Python source tree.
1713
1745
1746
+
1747
+ .. _whatsnew311-porting :
1748
+ .. _whatsnew311-python-api-porting :
1749
+
1714
1750
Porting to Python 3.11
1715
1751
======================
1716
1752
1717
1753
This section lists previously described changes and other bugfixes
1718
- that may require changes to your code.
1754
+ in the Python API that may require changes to your Python code.
1719
1755
1720
-
1721
- Changes in the Python API
1722
- -------------------------
1756
+ Porting notes for the C API are
1757
+ :ref: `listed separately <whatsnew311-c-api-porting >`.
1723
1758
1724
1759
* Prohibited passing non-:class: `concurrent.futures.ThreadPoolExecutor `
1725
1760
executors to :meth: `loop.set_default_executor ` following a deprecation in
@@ -1768,6 +1803,9 @@ Changes in the Python API
1768
1803
as meaningless when read. To get the pointer to the object's dictionary call
1769
1804
:c:func: `PyObject_GenericGetDict ` instead.
1770
1805
1806
+
1807
+ .. _whatsnew311-build-changes :
1808
+
1771
1809
Build Changes
1772
1810
=============
1773
1811
@@ -1855,9 +1893,13 @@ Build Changes
1855
1893
(Contributed by Serhiy Storchaka in :issue: `46996 `.)
1856
1894
1857
1895
1896
+ .. _whatsnew311-c-api :
1897
+
1858
1898
C API Changes
1859
1899
=============
1860
1900
1901
+ .. _whatsnew311-c-api-new-features :
1902
+
1861
1903
New Features
1862
1904
------------
1863
1905
@@ -1921,6 +1963,9 @@ New Features
1921
1963
* Added the :c:member: `PyConfig.safe_path ` member.
1922
1964
(Contributed by Victor Stinner in :gh: `57684 `.)
1923
1965
1966
+
1967
+ .. _whatsnew311-c-api-porting :
1968
+
1924
1969
Porting to Python 3.11
1925
1970
----------------------
1926
1971
@@ -2220,6 +2265,9 @@ Porting to Python 3.11
2220
2265
paths and then modify them, finish initialization and use :c:func: `PySys_GetObject `
2221
2266
to retrieve :data: `sys.path ` as a Python list object and modify it directly.
2222
2267
2268
+
2269
+ .. _whatsnew311-c-api-deprecated :
2270
+
2223
2271
Deprecated
2224
2272
----------
2225
2273
@@ -2245,6 +2293,35 @@ Deprecated
2245
2293
* Deprecate the ``ob_shash `` member of the :c:type: `PyBytesObject `. Use :c:func: `PyObject_Hash ` instead.
2246
2294
(Contributed by Inada Naoki in :issue: `46864 `.)
2247
2295
2296
+
2297
+ .. _whatsnew311-c-api-pending-removal :
2298
+
2299
+ Pending Removal in Python 3.12
2300
+ ------------------------------
2301
+
2302
+ The following C APIs have been deprecated in earlier Python releases,
2303
+ and will be removed in Python 3.12.
2304
+
2305
+ * :c:func: `PyUnicode_AS_DATA `
2306
+ * :c:func: `PyUnicode_AS_UNICODE `
2307
+ * :c:func: `PyUnicode_AsUnicodeAndSize `
2308
+ * :c:func: `PyUnicode_AsUnicode `
2309
+ * :c:func: `PyUnicode_FromUnicode `
2310
+ * :c:func: `PyUnicode_GET_DATA_SIZE `
2311
+ * :c:func: `PyUnicode_GET_SIZE `
2312
+ * :c:func: `PyUnicode_GetSize `
2313
+ * :c:func: `PyUnicode_IS_COMPACT `
2314
+ * :c:func: `PyUnicode_IS_READY `
2315
+ * :c:func: `PyUnicode_READY `
2316
+ * :c:func: `Py_UNICODE_WSTR_LENGTH `
2317
+ * :c:func: `_PyUnicode_AsUnicode `
2318
+ * :c:macro: `PyUnicode_WCHAR_KIND `
2319
+ * :c:type: `PyUnicodeObject `
2320
+ * :c:func: `PyUnicode_InternImmortal() `
2321
+
2322
+
2323
+ .. _whatsnew311-c-api-removed :
2324
+
2248
2325
Removed
2249
2326
-------
2250
2327
0 commit comments