Debian Codegraph @

Doc/deprecations/pending-removal-in-3.16.rst

raw
1 Pending removal in Python 3.16
2 ------------------------------
3
4 * The import system:
5
6 * Setting :attr:`~module.__loader__` on a module while
7 failing to set :attr:`__spec__.loader <importlib.machinery.ModuleSpec.loader>`
8 is deprecated. In Python 3.16, :attr:`!__loader__` will cease to be set or
9 taken into consideration by the import system or the standard library.
10
11 * :mod:`array`:
12
13 * The ``'u'`` format code (:c:type:`wchar_t`)
14 has been deprecated in documentation since Python 3.3
15 and at runtime since Python 3.13.
16 Use the ``'w'`` format code (:c:type:`Py_UCS4`)
17 for Unicode characters instead.
18
19 * :mod:`asyncio`:
20
21 * :func:`!asyncio.iscoroutinefunction` is deprecated
22 and will be removed in Python 3.16;
23 use :func:`inspect.iscoroutinefunction` instead.
24 (Contributed by Jiahao Li and Kumar Aditya in :gh:`122875`.)
25
26 * :mod:`asyncio` policy system is deprecated and will be removed in Python 3.16.
27 In particular, the following classes and functions are deprecated:
28
29 * :class:`asyncio.AbstractEventLoopPolicy`
30 * :class:`asyncio.DefaultEventLoopPolicy`
31 * :class:`asyncio.WindowsSelectorEventLoopPolicy`
32 * :class:`asyncio.WindowsProactorEventLoopPolicy`
33 * :func:`asyncio.get_event_loop_policy`
34 * :func:`asyncio.set_event_loop_policy`
35
36 Users should use :func:`asyncio.run` or :class:`asyncio.Runner` with
37 *loop_factory* to use the desired event loop implementation.
38
39 For example, to use :class:`asyncio.SelectorEventLoop` on Windows::
40
41 import asyncio
42
43 async def main():
44 ...
45
46 asyncio.run(main(), loop_factory=asyncio.SelectorEventLoop)
47
48 (Contributed by Kumar Aditya in :gh:`127949`.)
49
50 * :mod:`builtins`:
51
52 * Bitwise inversion on boolean types, ``~True`` or ``~False``
53 has been deprecated since Python 3.12,
54 as it produces surprising and unintuitive results (``-2`` and ``-1``).
55 Use ``not x`` instead for the logical negation of a Boolean.
56 In the rare case that you need the bitwise inversion of
57 the underlying integer, convert to ``int`` explicitly (``~int(x)``).
58
59 * :mod:`functools`:
60
61 * Calling the Python implementation of :func:`functools.reduce` with *function*
62 or *sequence* as keyword arguments has been deprecated since Python 3.14.
63
64 * :mod:`logging`:
65
66 Support for custom logging handlers with the *strm* argument is deprecated
67 and scheduled for removal in Python 3.16. Define handlers with the *stream*
68 argument instead. (Contributed by Mariusz Felisiak in :gh:`115032`.)
69
70 * :mod:`mimetypes`:
71
72 * Valid extensions start with a '.' or are empty for
73 :meth:`mimetypes.MimeTypes.add_type`.
74 Undotted extensions are deprecated and will
75 raise a :exc:`ValueError` in Python 3.16.
76 (Contributed by Hugo van Kemenade in :gh:`75223`.)
77
78 * :mod:`shutil`:
79
80 * The :class:`!ExecError` exception
81 has been deprecated since Python 3.14.
82 It has not been used by any function in :mod:`!shutil` since Python 3.4,
83 and is now an alias of :exc:`RuntimeError`.
84
85 * :mod:`symtable`:
86
87 * The :meth:`Class.get_methods <symtable.Class.get_methods>` method
88 has been deprecated since Python 3.14.
89
90 * :mod:`sys`:
91
92 * The :func:`~sys._enablelegacywindowsfsencoding` function
93 has been deprecated since Python 3.13.
94 Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` environment variable instead.
95
96 * :mod:`sysconfig`:
97
98 * The :func:`!sysconfig.expand_makefile_vars` function
99 has been deprecated since Python 3.14.
100 Use the ``vars`` argument of :func:`sysconfig.get_paths` instead.
101
102 * :mod:`tarfile`:
103
104 * The undocumented and unused :attr:`!TarFile.tarfile` attribute
105 has been deprecated since Python 3.13.