|
| 1 | +Pending Removal in Future Versions |
| 2 | +---------------------------------- |
| 3 | + |
| 4 | +The following APIs will be removed in the future, |
| 5 | +although there is currently no date scheduled for their removal. |
| 6 | + |
| 7 | +* :mod:`argparse`: Nesting argument groups and nesting mutually exclusive |
| 8 | + groups are deprecated. |
| 9 | + |
| 10 | +* :mod:`builtins`: |
| 11 | + |
| 12 | + * ``~bool``, bitwise inversion on bool. |
| 13 | + * ``bool(NotImplemented)``. |
| 14 | + * Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)`` |
| 15 | + signature is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead, |
| 16 | + the single argument signature. |
| 17 | + * Currently Python accepts numeric literals immediately followed by keywords, |
| 18 | + for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and |
| 19 | + ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as |
| 20 | + ``[0x1 for x in y]`` or ``[0x1f or x in y]``). A syntax warning is raised |
| 21 | + if the numeric literal is immediately followed by one of keywords |
| 22 | + :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, |
| 23 | + :keyword:`in`, :keyword:`is` and :keyword:`or`. In a future release it |
| 24 | + will be changed to a syntax error. (:gh:`87999`) |
| 25 | + * Support for ``__index__()`` and ``__int__()`` method returning non-int type: |
| 26 | + these methods will be required to return an instance of a strict subclass of |
| 27 | + :class:`int`. |
| 28 | + * Support for ``__float__()`` method returning a strict subclass of |
| 29 | + :class:`float`: these methods will be required to return an instance of |
| 30 | + :class:`float`. |
| 31 | + * Support for ``__complex__()`` method returning a strict subclass of |
| 32 | + :class:`complex`: these methods will be required to return an instance of |
| 33 | + :class:`complex`. |
| 34 | + * Delegation of ``int()`` to ``__trunc__()`` method. |
| 35 | + |
| 36 | +* :mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants are |
| 37 | + deprecated and replaced by :data:`calendar.JANUARY` and |
| 38 | + :data:`calendar.FEBRUARY`. |
| 39 | + (Contributed by Prince Roshan in :gh:`103636`.) |
| 40 | + |
| 41 | +* :attr:`codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method |
| 42 | + instead. |
| 43 | + |
| 44 | +* :mod:`datetime`: |
| 45 | + |
| 46 | + * :meth:`~datetime.datetime.utcnow`: |
| 47 | + use ``datetime.datetime.now(tz=datetime.UTC)``. |
| 48 | + * :meth:`~datetime.datetime.utcfromtimestamp`: |
| 49 | + use ``datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)``. |
| 50 | + |
| 51 | +* :mod:`gettext`: Plural value must be an integer. |
| 52 | + |
| 53 | +* :mod:`importlib`: |
| 54 | + |
| 55 | + * ``load_module()`` method: use ``exec_module()`` instead. |
| 56 | + * :func:`~importlib.util.cache_from_source` *debug_override* parameter is |
| 57 | + deprecated: use the *optimization* parameter instead. |
| 58 | + |
| 59 | +* :mod:`importlib.metadata`: |
| 60 | + |
| 61 | + * ``EntryPoints`` tuple interface. |
| 62 | + * Implicit ``None`` on return values. |
| 63 | + |
| 64 | +* :mod:`mailbox`: Use of StringIO input and text mode is deprecated, use |
| 65 | + BytesIO and binary mode instead. |
| 66 | + |
| 67 | +* :mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process. |
| 68 | + |
| 69 | +* :class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is |
| 70 | + deprecated, use an exception instance. |
| 71 | + |
| 72 | +* :mod:`re`: More strict rules are now applied for numerical group references |
| 73 | + and group names in regular expressions. Only sequence of ASCII digits is now |
| 74 | + accepted as a numerical reference. The group name in bytes patterns and |
| 75 | + replacement strings can now only contain ASCII letters and digits and |
| 76 | + underscore. |
| 77 | + (Contributed by Serhiy Storchaka in :gh:`91760`.) |
| 78 | + |
| 79 | +* :mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules. |
| 80 | + |
| 81 | +* :mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in |
| 82 | + Python 3.12; use the *onexc* parameter instead. |
| 83 | + |
| 84 | +* :mod:`ssl` options and protocols: |
| 85 | + |
| 86 | + * :class:`ssl.SSLContext` without protocol argument is deprecated. |
| 87 | + * :class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and |
| 88 | + :meth:`!selected_npn_protocol` are deprecated: use ALPN |
| 89 | + instead. |
| 90 | + * ``ssl.OP_NO_SSL*`` options |
| 91 | + * ``ssl.OP_NO_TLS*`` options |
| 92 | + * ``ssl.PROTOCOL_SSLv3`` |
| 93 | + * ``ssl.PROTOCOL_TLS`` |
| 94 | + * ``ssl.PROTOCOL_TLSv1`` |
| 95 | + * ``ssl.PROTOCOL_TLSv1_1`` |
| 96 | + * ``ssl.PROTOCOL_TLSv1_2`` |
| 97 | + * ``ssl.TLSVersion.SSLv3`` |
| 98 | + * ``ssl.TLSVersion.TLSv1`` |
| 99 | + * ``ssl.TLSVersion.TLSv1_1`` |
| 100 | + |
| 101 | +* :func:`sysconfig.is_python_build` *check_home* parameter is deprecated and |
| 102 | + ignored. |
| 103 | + |
| 104 | +* :mod:`threading` methods: |
| 105 | + |
| 106 | + * :meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition.notify_all`. |
| 107 | + * :meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`. |
| 108 | + * :meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: |
| 109 | + use :attr:`threading.Thread.daemon` attribute. |
| 110 | + * :meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: |
| 111 | + use :attr:`threading.Thread.name` attribute. |
| 112 | + * :meth:`!threading.currentThread`: use :meth:`threading.current_thread`. |
| 113 | + * :meth:`!threading.activeCount`: use :meth:`threading.active_count`. |
| 114 | + |
| 115 | +* :class:`typing.Text` (:gh:`92332`). |
| 116 | + |
| 117 | +* :class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a value |
| 118 | + that is not ``None`` from a test case. |
| 119 | + |
| 120 | +* :mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` instead |
| 121 | + |
| 122 | + * ``splitattr()`` |
| 123 | + * ``splithost()`` |
| 124 | + * ``splitnport()`` |
| 125 | + * ``splitpasswd()`` |
| 126 | + * ``splitport()`` |
| 127 | + * ``splitquery()`` |
| 128 | + * ``splittag()`` |
| 129 | + * ``splittype()`` |
| 130 | + * ``splituser()`` |
| 131 | + * ``splitvalue()`` |
| 132 | + * ``to_bytes()`` |
| 133 | + |
| 134 | +* :mod:`urllib.request`: :class:`~urllib.request.URLopener` and |
| 135 | + :class:`~urllib.request.FancyURLopener` style of invoking requests is |
| 136 | + deprecated. Use newer :func:`~urllib.request.urlopen` functions and methods. |
| 137 | + |
| 138 | +* :mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial |
| 139 | + writes. |
| 140 | + |
| 141 | +* :mod:`xml.etree.ElementTree`: Testing the truth value of an |
| 142 | + :class:`~xml.etree.ElementTree.Element` is deprecated. In a future release it |
| 143 | + will always return ``True``. Prefer explicit ``len(elem)`` or |
| 144 | + ``elem is not None`` tests instead. |
| 145 | + |
| 146 | +* :meth:`zipimport.zipimporter.load_module` is deprecated: |
| 147 | + use :meth:`~zipimport.zipimporter.exec_module` instead. |
0 commit comments