Skip to content

Commit 87ddfa7

Browse files
authored
GH-109190: Copyedit 3.12 What's New: Deprecations (#109766)
1 parent 4390c13 commit 87ddfa7

File tree

1 file changed

+153
-92
lines changed

1 file changed

+153
-92
lines changed

Doc/whatsnew/3.12.rst

+153-92
Original file line numberDiff line numberDiff line change
@@ -580,19 +580,10 @@ asyncio
580580
:class:`asyncio.ThreadedChildWatcher`.
581581
(Contributed by Kumar Aditya in :gh:`98024`.)
582582

583-
* The child watcher classes :class:`asyncio.MultiLoopChildWatcher`,
584-
:class:`asyncio.FastChildWatcher`, :class:`asyncio.AbstractChildWatcher`
585-
and :class:`asyncio.SafeChildWatcher` are deprecated and
586-
will be removed in Python 3.14. It is recommended to not manually
587-
configure a child watcher as the event loop now uses the best available
588-
child watcher for each platform (:class:`asyncio.PidfdChildWatcher`
589-
if supported and :class:`asyncio.ThreadedChildWatcher` otherwise).
590-
(Contributed by Kumar Aditya in :gh:`94597`.)
591-
592-
* :func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`,
593-
:meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` and
594-
:meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` are deprecated
595-
and will be removed in Python 3.14.
583+
* The event loop now uses the best available child watcher for each platform
584+
(:class:`asyncio.PidfdChildWatcher` if supported and
585+
:class:`asyncio.ThreadedChildWatcher` otherwise), so manually
586+
configuring a child watcher is not recommended.
596587
(Contributed by Kumar Aditya in :gh:`94597`.)
597588

598589
* Add *loop_factory* parameter to :func:`asyncio.run` to allow specifying
@@ -1046,15 +1037,52 @@ Demos and Tools
10461037
Deprecated
10471038
==========
10481039

1049-
* :mod:`asyncio`: The :meth:`~asyncio.get_event_loop` method of the
1050-
default event loop policy now emits a :exc:`DeprecationWarning` if there
1051-
is no current event loop set and it decides to create one.
1052-
(Contributed by Serhiy Storchaka and Guido van Rossum in :gh:`100160`.)
1040+
* :mod:`argparse`: The *type*, *choices*, and *metavar* parameters
1041+
of :class:`!argparse.BooleanOptionalAction` are deprecated
1042+
and will be removed in 3.14.
1043+
(Contributed by Nikita Sobolev in :gh:`92248`.)
1044+
1045+
* :mod:`ast`: The following :mod:`ast` features have been deprecated in documentation since
1046+
Python 3.8, now cause a :exc:`DeprecationWarning` to be emitted at runtime
1047+
when they are accessed or used, and will be removed in Python 3.14:
1048+
1049+
* :class:`!ast.Num`
1050+
* :class:`!ast.Str`
1051+
* :class:`!ast.Bytes`
1052+
* :class:`!ast.NameConstant`
1053+
* :class:`!ast.Ellipsis`
1054+
1055+
Use :class:`ast.Constant` instead.
1056+
(Contributed by Serhiy Storchaka in :gh:`90953`.)
1057+
1058+
* :mod:`asyncio`:
1059+
1060+
* The child watcher classes :class:`asyncio.MultiLoopChildWatcher`,
1061+
:class:`asyncio.FastChildWatcher`, :class:`asyncio.AbstractChildWatcher`
1062+
and :class:`asyncio.SafeChildWatcher` are deprecated and
1063+
will be removed in Python 3.14.
1064+
(Contributed by Kumar Aditya in :gh:`94597`.)
1065+
1066+
* :func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`,
1067+
:meth:`asyncio.AbstractEventLoopPolicy.set_child_watcher` and
1068+
:meth:`asyncio.AbstractEventLoopPolicy.get_child_watcher` are deprecated
1069+
and will be removed in Python 3.14.
1070+
(Contributed by Kumar Aditya in :gh:`94597`.)
1071+
1072+
* The :meth:`~asyncio.get_event_loop` method of the
1073+
default event loop policy now emits a :exc:`DeprecationWarning` if there
1074+
is no current event loop set and it decides to create one.
1075+
(Contributed by Serhiy Storchaka and Guido van Rossum in :gh:`100160`.)
10531076

10541077
* :mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants are deprecated and
10551078
replaced by :data:`calendar.JANUARY` and :data:`calendar.FEBRUARY`.
10561079
(Contributed by Prince Roshan in :gh:`103636`.)
10571080

1081+
* :mod:`collections.abc`: Deprecated :class:`collections.abc.ByteString`.
1082+
Prefer :class:`Sequence` or :class:`collections.abc.Buffer`.
1083+
For use in typing, prefer a union, like ``bytes | bytearray``, or :class:`collections.abc.Buffer`.
1084+
(Contributed by Shantanu Jain in :gh:`91896`.)
1085+
10581086
* :mod:`datetime`: :class:`datetime.datetime`'s :meth:`~datetime.datetime.utcnow` and
10591087
:meth:`~datetime.datetime.utcfromtimestamp` are deprecated and will be
10601088
removed in a future version. Instead, use timezone-aware objects to represent
@@ -1063,12 +1091,55 @@ Deprecated
10631091
:const:`datetime.UTC`.
10641092
(Contributed by Paul Ganssle in :gh:`103857`.)
10651093

1094+
* :mod:`email`: Deprecate the *isdst* parameter in :func:`email.utils.localtime`.
1095+
(Contributed by Alan Williams in :gh:`72346`.)
1096+
1097+
* :mod:`importlib.abc`: Deprecated the following classes, scheduled for removal in
1098+
Python 3.14:
1099+
1100+
* :class:`!importlib.abc.ResourceReader`
1101+
* :class:`!importlib.abc.Traversable`
1102+
* :class:`!importlib.abc.TraversableResources`
1103+
1104+
Use :mod:`importlib.resources.abc` classes instead:
1105+
1106+
* :class:`importlib.resources.abc.Traversable`
1107+
* :class:`importlib.resources.abc.TraversableResources`
1108+
1109+
(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)
1110+
1111+
* :mod:`itertools`: Deprecate the support for copy, deepcopy, and pickle operations,
1112+
which is undocumented, inefficient, historically buggy, and inconsistent.
1113+
This will be removed in 3.14 for a significant reduction in code
1114+
volume and maintenance burden.
1115+
(Contributed by Raymond Hettinger in :gh:`101588`.)
1116+
10661117
* :mod:`os`: The ``st_ctime`` fields return by :func:`os.stat` and :func:`os.lstat` on
10671118
Windows are deprecated. In a future release, they will contain the last
10681119
metadata change time, consistent with other platforms. For now, they still
10691120
contain the creation time, which is also available in the new ``st_birthtime``
10701121
field. (Contributed by Steve Dower in :gh:`99726`.)
10711122

1123+
* :mod:`multiprocessing`: In Python 3.14, the default :mod:`multiprocessing`
1124+
start method will change to a safer one on Linux, BSDs,
1125+
and other non-macOS POSIX platforms where ``'fork'`` is currently
1126+
the default (:gh:`84559`). Adding a runtime warning about this was deemed too
1127+
disruptive as the majority of code is not expected to care. Use the
1128+
:func:`~multiprocessing.get_context` or
1129+
:func:`~multiprocessing.set_start_method` APIs to explicitly specify when
1130+
your code *requires* ``'fork'``. See :ref:`contexts and start methods
1131+
<multiprocessing-start-methods>`.
1132+
1133+
* :mod:`pkgutil`: :func:`pkgutil.find_loader` and :func:`pkgutil.get_loader`
1134+
are deprecated and will be removed in Python 3.14;
1135+
use :func:`importlib.util.find_spec` instead.
1136+
(Contributed by Nikita Sobolev in :gh:`97850`.)
1137+
1138+
* :mod:`pty`: The module has two undocumented ``master_open()`` and ``slave_open()``
1139+
functions that have been deprecated since Python 2 but only gained a
1140+
proper :exc:`DeprecationWarning` in 3.12. Remove them in 3.14.
1141+
(Contributed by Soumendra Ganguly and Gregory P. Smith in :gh:`85984`.)
1142+
10721143
* :mod:`os`: On POSIX platforms, :func:`os.fork` can now raise a
10731144
:exc:`DeprecationWarning` when it can detect being called from a
10741145
multithreaded process. There has always been a fundamental incompatibility
@@ -1083,22 +1154,23 @@ Deprecated
10831154
:mod:`concurrent.futures` the fix is to use a different
10841155
:mod:`multiprocessing` start method such as ``"spawn"`` or ``"forkserver"``.
10851156

1086-
* :mod:`shutil`: The *onerror* argument of :func:`shutil.rmtree` is deprecated as will be removed
1157+
* :mod:`shutil`: The *onerror* argument of :func:`shutil.rmtree` is deprecated and will be removed
10871158
in Python 3.14. Use *onexc* instead. (Contributed by Irit Katriel in :gh:`102828`.)
10881159

10891160
* :mod:`sqlite3`:
1090-
* :ref:`default adapters and converters
1091-
<sqlite3-default-converters>` are now deprecated.
1092-
Instead, use the :ref:`sqlite3-adapter-converter-recipes`
1093-
and tailor them to your needs.
1094-
(Contributed by Erlend E. Aasland in :gh:`90016`.)
1095-
1096-
* In :meth:`~sqlite3.Cursor.execute`, :exc:`DeprecationWarning` is now emitted
1097-
when :ref:`named placeholders <sqlite3-placeholders>` are used together with
1098-
parameters supplied as a :term:`sequence` instead of as a :class:`dict`.
1099-
Starting from Python 3.14, using named placeholders with parameters supplied
1100-
as a sequence will raise a :exc:`~sqlite3.ProgrammingError`.
1101-
(Contributed by Erlend E. Aasland in :gh:`101698`.)
1161+
1162+
* :ref:`default adapters and converters
1163+
<sqlite3-default-converters>` are now deprecated.
1164+
Instead, use the :ref:`sqlite3-adapter-converter-recipes`
1165+
and tailor them to your needs.
1166+
(Contributed by Erlend E. Aasland in :gh:`90016`.)
1167+
1168+
* In :meth:`~sqlite3.Cursor.execute`, :exc:`DeprecationWarning` is now emitted
1169+
when :ref:`named placeholders <sqlite3-placeholders>` are used together with
1170+
parameters supplied as a :term:`sequence` instead of as a :class:`dict`.
1171+
Starting from Python 3.14, using named placeholders with parameters supplied
1172+
as a sequence will raise a :exc:`~sqlite3.ProgrammingError`.
1173+
(Contributed by Erlend E. Aasland in :gh:`101698`.)
11021174

11031175
* :mod:`sys`: The :data:`sys.last_type`, :data:`sys.last_value` and :data:`sys.last_traceback`
11041176
fields are deprecated. Use :data:`sys.last_exc` instead.
@@ -1108,16 +1180,24 @@ Deprecated
11081180
Python 3.14, when ``'data'`` filter will become the default.
11091181
See :ref:`tarfile-extraction-filter` for details.
11101182

1111-
* :mod:`typing`: :class:`typing.Hashable` and :class:`typing.Sized` aliases for :class:`collections.abc.Hashable`
1112-
and :class:`collections.abc.Sized`. (:gh:`94309`.)
1183+
* :mod:`typing`:
1184+
1185+
* :class:`typing.Hashable` and :class:`typing.Sized` aliases for :class:`collections.abc.Hashable`
1186+
and :class:`collections.abc.Sized`. (:gh:`94309`.)
1187+
1188+
* :class:`typing.ByteString`, deprecated since Python 3.9, now causes a
1189+
:exc:`DeprecationWarning` to be emitted when it is used.
1190+
(Contributed by Alex Waygood in :gh:`91896`.)
11131191

11141192
* :mod:`xml.etree.ElementTree`: The module now emits :exc:`DeprecationWarning`
11151193
when testing the truth value of an :class:`xml.etree.ElementTree.Element`.
11161194
Before, the Python implementation emitted :exc:`FutureWarning`, and the C
11171195
implementation emitted nothing.
1196+
(Contributed by Jacob Walls in :gh:`83122`.)
11181197

1119-
* The 3-arg signatures (type, value, traceback) of :meth:`~coroutine.throw`,
1120-
:meth:`~generator.throw` and :meth:`~agen.athrow` are deprecated and
1198+
* The 3-arg signatures (type, value, traceback) of :meth:`coroutine throw()
1199+
<coroutine.throw>`, :meth:`generator throw() <generator.throw>` and
1200+
:meth:`async generator throw() <agen.athrow>` are deprecated and
11211201
may be removed in a future version of Python. Use the single-arg versions
11221202
of these functions instead. (Contributed by Ofey Chan in :gh:`89874`.)
11231203

@@ -1126,12 +1206,21 @@ Deprecated
11261206
:exc:`ImportWarning`).
11271207
(Contributed by Brett Cannon in :gh:`65961`.)
11281208

1209+
* Setting ``__package__`` or ``__cached__`` on a module is deprecated,
1210+
and will cease to be set or taken into consideration by the import system in Python 3.14.
1211+
(Contributed by Brett Cannon in :gh:`65961`.)
1212+
11291213
* The bitwise inversion operator (``~``) on bool is deprecated. It will throw an
11301214
error in Python 3.14. Use ``not`` for logical negation of bools instead.
11311215
In the rare case that you really need the bitwise inversion of the underlying
1132-
``int``, convert to int explicitly with ``~int(x)``. (Contributed by Tim Hoffmann
1216+
``int``, convert to int explicitly: ``~int(x)``. (Contributed by Tim Hoffmann
11331217
in :gh:`103487`.)
11341218

1219+
* Accessing ``co_lnotab`` on code objects was deprecated in Python 3.10 via :pep:`626`,
1220+
but it only got a proper :exc:`DeprecationWarning` in 3.12,
1221+
therefore it will be removed in 3.14.
1222+
(Contributed by Nikita Sobolev in :gh:`101866`.)
1223+
11351224
Pending Removal in Python 3.13
11361225
------------------------------
11371226

@@ -1180,90 +1269,62 @@ APIs:
11801269
Pending Removal in Python 3.14
11811270
------------------------------
11821271

1272+
The following APIs have been deprecated
1273+
and will be removed in Python 3.14.
1274+
11831275
* :mod:`argparse`: The *type*, *choices*, and *metavar* parameters
1184-
of :class:`!argparse.BooleanOptionalAction` are deprecated
1185-
and will be removed in 3.14.
1186-
(Contributed by Nikita Sobolev in :gh:`92248`.)
1276+
of :class:`!argparse.BooleanOptionalAction`
11871277

1188-
* :mod:`ast`: The following :mod:`ast` features have been deprecated in documentation since
1189-
Python 3.8, now cause a :exc:`DeprecationWarning` to be emitted at runtime
1190-
when they are accessed or used, and will be removed in Python 3.14:
1278+
* :mod:`ast`:
11911279

11921280
* :class:`!ast.Num`
11931281
* :class:`!ast.Str`
11941282
* :class:`!ast.Bytes`
11951283
* :class:`!ast.NameConstant`
11961284
* :class:`!ast.Ellipsis`
11971285

1198-
Use :class:`ast.Constant` instead.
1199-
(Contributed by Serhiy Storchaka in :gh:`90953`.)
1286+
* :mod:`asyncio`:
12001287

1201-
* :mod:`asyncio`: the *msg* parameter of both
1202-
:meth:`asyncio.Future.cancel` and
1203-
:meth:`asyncio.Task.cancel` (:gh:`90985`)
1288+
* :class:`!asyncio.MultiLoopChildWatcher`
1289+
* :class:`!asyncio.FastChildWatcher`
1290+
* :class:`!asyncio.AbstractChildWatcher`
1291+
* :class:`!asyncio.SafeChildWatcher`
1292+
* :func:`!asyncio.set_child_watcher`
1293+
* :func:`!asyncio.get_child_watcher`,
1294+
* :meth:`!asyncio.AbstractEventLoopPolicy.set_child_watcher`
1295+
* :meth:`!asyncio.AbstractEventLoopPolicy.get_child_watcher`
12041296

1205-
* :mod:`collections.abc`: Deprecated :class:`collections.abc.ByteString`.
1206-
Prefer :class:`Sequence` or :class:`collections.abc.Buffer`.
1207-
For use in typing, prefer a union, like ``bytes | bytearray``, or :class:`collections.abc.Buffer`.
1208-
(Contributed by Shantanu Jain in :gh:`91896`.)
1297+
* :mod:`collections.abc`: :class:`!collections.abc.ByteString`.
12091298

1210-
* :mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils.localtime`.
1211-
(Contributed by Alan Williams in :gh:`72346`.)
1299+
* :mod:`email`: the *isdst* parameter in :func:`email.utils.localtime`.
12121300

1213-
* :mod:`importlib.abc`: Deprecated the following classes, scheduled for removal in
1214-
Python 3.14:
1301+
* :mod:`importlib.abc`:
12151302

12161303
* :class:`!importlib.abc.ResourceReader`
12171304
* :class:`!importlib.abc.Traversable`
12181305
* :class:`!importlib.abc.TraversableResources`
12191306

1220-
Use :mod:`importlib.resources.abc` classes instead:
1307+
* :mod:`itertools`: Support for copy, deepcopy, and pickle operations.
12211308

1222-
* :class:`importlib.resources.abc.Traversable`
1223-
* :class:`importlib.resources.abc.TraversableResources`
1224-
1225-
(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)
1226-
1227-
* :mod:`itertools`: The module had undocumented, inefficient, historically buggy,
1228-
and inconsistent support for copy, deepcopy, and pickle operations.
1229-
This will be removed in 3.14 for a significant reduction in code
1230-
volume and maintenance burden.
1231-
(Contributed by Raymond Hettinger in :gh:`101588`.)
1309+
* :mod:`pkgutil`:
12321310

1233-
* :mod:`multiprocessing`: The default :mod:`multiprocessing` start method will change to a safer one on
1234-
Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is currently
1235-
the default (:gh:`84559`). Adding a runtime warning about this was deemed too
1236-
disruptive as the majority of code is not expected to care. Use the
1237-
:func:`~multiprocessing.get_context` or
1238-
:func:`~multiprocessing.set_start_method` APIs to explicitly specify when
1239-
your code *requires* ``'fork'``. See :ref:`multiprocessing-start-methods`.
1311+
* :func:`!pkgutil.find_loader`
1312+
* :func:`!pkgutil.get_loader`.
12401313

1241-
* :mod:`pkgutil`: :func:`pkgutil.find_loader` and :func:`pkgutil.get_loader`
1242-
now raise :exc:`DeprecationWarning`;
1243-
use :func:`importlib.util.find_spec` instead.
1244-
(Contributed by Nikita Sobolev in :gh:`97850`.)
1314+
* :mod:`pty`:
12451315

1246-
* :mod:`pty`: The module has two undocumented ``master_open()`` and ``slave_open()``
1247-
functions that have been deprecated since Python 2 but only gained a
1248-
proper :exc:`DeprecationWarning` in 3.12. Remove them in 3.14.
1316+
* :func:`!pty.master_open`
1317+
* :func:`!pty.slave_open`
12491318

1250-
* :mod:`shutil`: The *onerror* argument of :func:`shutil.rmtree` is deprecated in 3.12,
1251-
and will be removed in 3.14.
1319+
* :mod:`shutil`: The *onerror* argument of :func:`shutil.rmtree`
12521320

1253-
* :mod:`typing`: :class:`typing.ByteString`, deprecated since Python 3.9, now causes a
1254-
:exc:`DeprecationWarning` to be emitted when it is used.
1321+
* :mod:`typing`: :class:`!typing.ByteString`
12551322

1256-
* :mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`xml.etree.ElementTree.Element`
1257-
is deprecated and will raise an exception in Python 3.14.
1323+
* :mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`xml.etree.ElementTree.Element`.
12581324

1259-
* ``__package__`` and ``__cached__`` will cease to be set or taken
1260-
into consideration by the import system (:gh:`97879`).
1325+
* The ``__package__`` and ``__cached__`` attributes on module objects.
12611326

1262-
* Accessing ``co_lnotab`` was deprecated in :pep:`626` since 3.10
1263-
and was planned to be removed in 3.12
1264-
but it only got a proper :exc:`DeprecationWarning` in 3.12.
1265-
May be removed in 3.14.
1266-
(Contributed by Nikita Sobolev in :gh:`101866`.)
1327+
* The ``co_lnotab`` attribute of code objects.
12671328

12681329
Pending Removal in Future Versions
12691330
----------------------------------

0 commit comments

Comments
 (0)