| Release: | |release| |
|---|---|
| Date: | |today| |
This article explains the new features in Python 3.13, compared to 3.12.
For full details, see the :ref:`changelog <changelog>`.
Note
Prerelease users should be aware that this document is currently in draft form. It will be updated substantially as Python 3.13 moves towards release, so it's worth checking back even after reading earlier versions.
- None yet.
PEP 594: Remove the :mod:`!telnetlib` module, deprecated in Python 3.11: use the projects telnetlib3 or Exscript instead. (Contributed by Victor Stinner in :gh:`104773`.)
Remove the
2to3program and the :mod:`!lib2to3` module, deprecated in Python 3.11. (Contributed by Victor Stinner in :gh:`104780`.)Namespaces
typing.ioandtyping.re, deprecated in Python 3.8, are now removed. The items in those namespaces can be imported directly from :mod:`typing`. (Contributed by Sebastian Rittau in :gh:`92871`.)Remove the untested and undocumented :mod:`webbrowser` :class:`!MacOSX` class, deprecated in Python 3.11. Use the :class:`!MacOSXOSAScript` class (introduced in Python 3.2) instead. (Contributed by Hugo van Kemenade in :gh:`104804`.)
Remove support for using :class:`pathlib.Path` objects as context managers. This functionality was deprecated and made a no-op in Python 3.9.
Remove the undocumented :class:`!configparser.LegacyInterpolation` class, deprecated in the docstring since Python 3.2, and with a deprecation warning since Python 3.11. (Contributed by Hugo van Kemenade in :gh:`104886`.)
Remove the :meth:`!turtle.RawTurtle.settiltangle` method, deprecated in docs since Python 3.1 and with a deprecation warning since Python 3.11. (Contributed by Hugo van Kemenade in :gh:`104876`.)
Removed the following :mod:`unittest` functions, deprecated in Python 3.11:
- :func:`!unittest.findTestCases`
- :func:`!unittest.makeSuite`
- :func:`!unittest.getTestCaseNames`
Use :class:`~unittest.TestLoader` methods instead:
- :meth:`unittest.TestLoader.loadTestsFromModule`
- :meth:`unittest.TestLoader.loadTestsFromTestCase`
- :meth:`unittest.TestLoader.getTestCaseNames`
(Contributed by Hugo van Kemenade in :gh:`104835`.)
PEP 594: Remove the :mod:`!cgi`` and :mod:`!cgitb` modules, deprecated in Python 3.11.
cgi.FieldStoragecan typically be replaced with :func:`urllib.parse.parse_qsl` forGETandHEADrequests, and the :mod:`email.message` module or multipart PyPI project forPOSTandPUT.cgi.parse()can be replaced by calling :func:`urllib.parse.parse_qs` directly on the desired query string, except formultipart/form-datainput, which can be handled as described forcgi.parse_multipart().cgi.parse_multipart()can be replaced with the functionality in the :mod:`email` package (e.g. :class:`email.message.EmailMessage` and :class:`email.message.Message`) which implements the same MIME RFCs, or with the multipart PyPI project.cgi.parse_header()can be replaced with the functionality in the :mod:`email` package, which implements the same MIME RFCs. For example, with :class:`email.message.EmailMessage`:from email.message import EmailMessage msg = EmailMessage() msg['content-type'] = 'application/json; charset="utf8"' main, params = msg.get_content_type(), msg['content-type'].params
(Contributed by Victor Stinner in :gh:`104773`.)
PEP 594: Remove the :mod:`!sndhdr` module, deprecated in Python 3.11: use the projects filetype, puremagic, or python-magic instead. (Contributed by Victor Stinner in :gh:`104773`.)
PEP 594: Remove the :mod:`!pipes` module, deprecated in Python 3.11: use the :mod:`subprocess` module instead. (Contributed by Victor Stinner in :gh:`104773`.)
PEP 594: Remove the :mod:`!ossaudiodev` module, deprecated in Python 3.11: use the pygame project for audio playback. (Contributed by Victor Stinner in :gh:`104780`.)
PEP 594: Remove the :mod:`!sunau` module, deprecated in Python 3.11. (Contributed by Victor Stinner in :gh:`104773`.)
PEP 594: Remove the :mod:`!mailcap` module, deprecated in Python 3.11. The :mod:`mimetypes` module provides an alternative. (Contributed by Victor Stinner in :gh:`104773`.)
PEP 594: Remove the :mod:`!spwd` module, deprecated in Python 3.11: the python-pam project can be used instead. (Contributed by Victor Stinner in :gh:`104773`.)
PEP 594: Remove the :mod:`!nntplib` module, deprecated in Python 3.11: the PyPI nntplib project can be used instead. (Contributed by Victor Stinner in :gh:`104773`.)
PEP 594: Remove the :mod:`!nis` module, deprecated in Python 3.11. (Contributed by Victor Stinner in :gh:`104773`.)
PEP 594: Remove the :mod:`!xdrlib` module, deprecated in Python 3.11. (Contributed by Victor Stinner in :gh:`104773`.)
PEP 594: Remove the :mod:`!msilib` module, deprecated in Python 3.11. (Contributed by Zachary Ware in :gh:`104773`.)
PEP 594: Remove the :mod:`!crypt` module and its private :mod:`!_crypt` extension, deprecated in Python 3.11. The :mod:`hashlib` module is a potential replacement for certain use cases. Otherwise, the following PyPI projects can be used:
- bcrypt: Modern password hashing for your software and your servers.
- passlib: Comprehensive password hashing framework supporting over 30 schemes.
- argon2-cffi: The secure Argon2 password hashing algorithm.
- legacycrypt: Wrapper to the POSIX crypt library call and associated functionality.
(Contributed by Victor Stinner in :gh:`104773`.)
PEP 594: Remove the :mod:`!uu` module, deprecated in Python 3.11: the :mod:`base64` module is a modern alternative. (Contributed by Victor Stinner in :gh:`104773`.)
PEP 594: Remove the :mod:`!aifc` module, deprecated in Python 3.11. (Contributed by Victor Stinner in :gh:`104773`.)
PEP 594: Remove the :mod:`!audioop` module, deprecated in Python 3.11. (Contributed by Victor Stinner in :gh:`104773`.)
PEP 594: Remove the :mod:`!chunk` module, deprecated in Python 3.11. (Contributed by Victor Stinner in :gh:`104773`.)
Remove support for the keyword-argument method of creating :class:`typing.TypedDict` types, deprecated in Python 3.11. (Contributed by Tomas Roun in :gh:`104786`.)
PEP 594: Remove the :mod:`!imghdr` module, deprecated in Python 3.11: use the projects filetype, puremagic, or python-magic instead. (Contributed by Victor Stinner in :gh:`104773`.)
Remove the untested and undocumented :meth:`!unittest.TestProgram.usageExit` method, deprecated in Python 3.11. (Contributed by Hugo van Kemenade in :gh:`104992`.)
Remove the :mod:`!tkinter.tix` module, deprecated in Python 3.6. The third-party Tix library which the module wrapped is unmaintained. (Contributed by Zachary Ware in :gh:`75552`.)
This section lists previously described changes and other bugfixes that may require changes to your code.