Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4133 pages

Upgrades and deprecations

Python 3.9 to 3.12: What Breaks at Each Release, and the Hop Order

In short

To upgrade Python 3.9 to 3.12 is to absorb three releases of removals at once: `distutils`, `imp`, `asyncore`, `asynchat` and `smtpd` are gone, old `unittest` aliases fail, and new virtual environments ship without setuptools. 3.9 reached end of life on 31 October 2025, and 3.12 itself takes security fixes only, scheduled to end in October 2028.

Where do 3.9 through 3.12 stand on the official status page today?

The Python devguide versions page splits branches into supported and unsupported. On 20 November 2026 it lists 3.9 and 3.10 as end of life, and 3.11, 3.12 and 3.13 as security-only. Dates marked with an asterisk on that page are scheduled and can move.

The policy behind the dates: a release takes bug fixes for two years (18 months for releases before 3.13), then security fixes only with no new binaries, and reaches end of life five years after its first release. So 3.12 has already left its bugfix phase.

BranchFirst releaseEnd of lifeStatus on 20 Nov 2026
3.95 Oct 202031 Oct 2025End of life
3.104 Oct 20211 Oct 2026End of life
3.1124 Oct 2022Oct 2027 (scheduled)Security fixes only
3.122 Oct 2023Oct 2028 (scheduled)Security fixes only
3.137 Oct 2024Oct 2029 (scheduled)Security fixes only
3.147 Oct 2025Oct 2030 (scheduled)Bug fixes

Checked against: source 1

Should I upgrade Python 3.9 to 3.12 in one jump or through 3.10 and 3.11?

Each What's New page explains changes against the release just before it, and removals usually follow a deprecation one or two releases earlier. distutils was deprecated in 3.10 and removed in 3.12. The 3.11 notes already list asynchat, asyncore and smtpd, plus SafeConfigParser and readfp(), as due for removal in 3.12.

That is the argument for hops. Running the test suite on 3.10 and then 3.11 shows those deprecation warnings while the old names still work, so each fix can land on its own. Jumping straight to 3.12 turns the same warnings into ImportError and AttributeError.

Deprecation warnings are hidden by the default filters. The Python Development Mode docs say -X dev (or PYTHONDEVMODE=1) adds a default warning filter that shows DeprecationWarning and PendingDeprecationWarning, as if -W default were passed. I would turn it on in the test run at 3.9 first, then at each hop.

Checked against: source 2, source 3, source 4, source 5

What does 3.10 take away from 3.9 code?

These come from the Removed and Porting sections of the 3.10 notes. The first two are the most common in older code.

  • The aliases to the abstract base classes in collections, such as collections.Mapping, are removed. Import them from collections.abc.
  • The loop parameter is removed from most of the high-level asyncio API, so asyncio.sleep(1, loop=loop) must drop the argument. The low-level API still takes it.
  • The parser and formatter modules are removed.
  • hashlib and ssl need OpenSSL 1.1.1 or newer (PEP 644), and SSLContext defaults to TLS 1.2 as the minimum.
  • Functions that take integers stop accepting objects that only define __int__() without __index__(), such as Decimal.
  • urllib.parse.parse_qs() accepts one separator, & by default, so ; no longer splits query strings.

Checked against: source 2

What does 3.11 remove on top of that?

The 3.11 list is shorter but hits old async code and old introspection helpers.

  • The @asyncio.coroutine decorator is gone; write async def.
  • inspect.getargspec() and inspect.formatargspec() are removed in favour of inspect.signature().
  • The binhex module and the binascii hqx functions are removed.
  • lgettext() and the other l*gettext() functions leave gettext.
  • open() no longer accepts the 'U' mode flag.
  • random.sample() stops converting a set to a sequence, and random.shuffle() loses its random argument.
  • Converting a very long decimal string to int raises ValueError past 4,300 digits by default. The 3.10 notes carry the same limit as a later security change, so a patched 3.10 hits it too.
  • Nineteen PEP 594 modules, including cgi, crypt and telnetlib, start warning ahead of removal in 3.13.

Checked against: source 2, source 3

Which 3.12 removals fail as soon as a module is imported?

3.12 has the longest Removed section of the three. These are the ones that stop a program at import or at first call rather than changing a result.

  • distutils is removed. Installing setuptools still provides it, as the notes say.
  • venv no longer installs setuptools, so pkg_resources and easy_install are missing unless setuptools is declared as a dependency. Building packages is a separate path, covered in pip cannot find setuptools.
  • imp is removed. The notes give a mapping table, for example imp.reload() to importlib.reload(), and a recipe to replace imp.load_source().
  • asynchat and asyncore are removed in favour of asyncio; smtpd points to the aiosmtpd package.
  • unittest drops assertEquals, assertNotEquals, assertRegexpMatches, failUnless and other old aliases.
  • configparser loses SafeConfigParser and readfp(); use ConfigParser and read_file().
  • ssl.wrap_socket() and ssl.match_hostname() are removed; the notes point to SSLContext.wrap_socket().
  • locale.format() is removed in favour of locale.format_string().

Checked against: source 4

What changes quietly, without an import error?

Some changes pass every import and only show up in results or warnings. In 3.12 an invalid escape such as "\d" in a normal string emits SyntaxWarning instead of DeprecationWarning, and the notes say it will become a SyntaxError later. datetime.utcnow() and utcfromtimestamp() are deprecated in favour of timezone-aware calls.

Also in 3.12: cached_property drops its class-wide lock, so a getter can run twice under a thread race; randrange(10.0) raises TypeError; the os module rejects bytearray paths; and mixing tabs and spaces in one file raises TabError.

Earlier hops add their own. In 3.11, re fixes bugs that could return wrong capture groups and allows global inline flags only at the start of a pattern. In 3.10, urllib.parse strips newlines and tabs from URLs, and collections.abc.Callable flattens its __args__.

Checked against: source 2, source 3, source 4

What else do people ask?

Is 3.12 still a sensible target when it already takes security fixes only?

Its scheduled end is October 2028 on the devguide page. Moving to 3.13 or 3.14 means reading one or two more What's New pages, including the PEP 594 removals that 3.11 announced for 3.13.

Do the What's New pages cover my dependencies?

No. They describe CPython and its standard library. Each third-party package states its own supported Python versions, so check those before each hop.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. This page reads the Python devguide status page and the What's New pages for 3.10, 3.11 and 3.12, fetched on 20 Nov 2026. I did not upgrade a codebase for it. It does not cover C extensions, the C API changes, third-party packages or operating-system Python packages. Found a mistake? Tell me.

Keep reading

Next step

Have a project in mind?

Tell me about it. A discovery call within 48 hours.