Python 3.13.9 Released: Emergency Fix for Critical Regression

From Nomalvo, the free encyclopedia of technology

Overview

The Python development team has announced the immediate availability of Python 3.13.9, an expedited release that addresses a specific regression introduced in the previous version, Python 3.13.8. This micro-release is solely focused on restoring functionality to the inspect.getsourcelines() function when decorators are followed by comments or blank lines—a scenario that broke unexpectedly in the earlier update. No other changes or features have been included, making this a surgical fix aimed at maintaining stability.

Python 3.13.9 Released: Emergency Fix for Critical Regression

The Regression in Python 3.13.8

When Python 3.13.8 shipped, users quickly noticed an anomaly: the inspect.getsourcelines() utility, which retrieves source code lines for a given object, raised errors or returned incorrect results when a function or class decorator was immediately followed by a comment line or an empty line in the source file. This behavior had been working flawlessly for years, and the change was traced to an unintended side effect of an earlier optimization.

Regression bugs are particularly disruptive because they break code that previously ran without issues. For developers relying on introspection tools—especially those building debugging utilities, IDEs, or documentation generators—this regression caused immediate problems. The lack of any warning in the 3.13.8 changelog made it even more frustrating for those who upgraded expecting full backward compatibility.

What Changed in Python 3.13.9

The fix was implemented as GitHub issue #139783 and addresses the exact scenario: when a decorator is followed by a comment (# ...) or an empty line, inspect.getsourcelines() now correctly skips those lines and identifies the actual source code of the decorated object. The changeset is minimal and does not touch any other part of the codebase.

Because this was an expedited release, the version number jumped from 3.13.8 directly to 3.13.9, bypassing the usual monthly cycle. Users who installed Python 3.13.8 are strongly urged to upgrade to 3.13.9 immediately.

Implications for Python Developers

For most Python developers, the impact is minimal: the bug only affected those using inspect.getsourcelines() on code that uses decorators and has comments or blank lines right after them. However, in environments where introspection is critical—such as test frameworks (pytest, unittest), static analysis tools (mypy, pyright), or code generation pipelines—the regression could cause silent failures or crashes.

It's worth noting that no other functions in the inspect module were affected. The fix is isolated to the single line of logic that parses source lines during tokenization. If you are not using inspect.getsourcelines() on decorated code with adjacent comments, you may not notice any difference between 3.13.8 and 3.13.9.

How to Upgrade to Python 3.13.9

Python 3.13.9 is available for download from the official Python releases page. Installation methods vary:

  • Windows: Download the installer (64-bit or 32-bit) and run it. The installer will replace your existing Python 3.13.x installation.
  • macOS: Use the official macOS 64-bit universal2 installer.
  • Linux (via PPA): On Ubuntu/Debian, use the deadsnakes PPA to install python3.13.9.
  • Source code: Build from source using the tarball on the downloads page.

If you manage multiple Python versions via pyenv or conda, update accordingly. For pyenv, run:

pyenv install 3.13.9
pyenv global 3.13.9

The Expedited Release Process

A point release (the third number) typically includes bug fixes, security patches, and sometimes small features. An expedited release, like 3.13.9, is reserved for regressions that warrant immediate attention. The Python release team—comprising Thomas Wouters, Ned Deily, Steve Dower, and Łukasz Langa—follows a strict procedure:

  1. An issue is reported and confirmed as a regression.
  2. A fix is developed, reviewed, and merged within days.
  3. A new release candidate may be skipped if the fix is minimal.
  4. The final source archive and binaries are built and signed.

This process ensures that users are not left with a broken version for weeks. The team also updates the official documentation and changelog simultaneously.

Acknowledgments and Community Support

The Python Software Foundation (PSF) and the entire release team extend their gratitude to the many volunteers who contribute to Python's development. This release was made possible by the swift identification of the bug by community members and the rapid response of core developers. If you benefit from Python, consider supporting the PSF financially or by contributing your time to open‑source projects.

To report issues with this or any other Python version, visit the CPython issue tracker.

Additional Resources

For more details, consult:

Enjoy the updated release and happy coding!