| 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 support for using :class:`pathlib.Path` objects as context managers. This functionality was deprecated and made a no-op in Python 3.9.
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`.)
This section lists previously described changes and other bugfixes that may require changes to your code.