Python 3.13.9 Released: A Targeted Fix for Developers

From Tuyetthe, the free encyclopedia of technology

Overview of the Release

The Python development team has announced the availability of Python 3.13.9, an expedited maintenance release designed to address a specific regression introduced in Python 3.13.8. This release is focused and minimal, containing only one change relative to its predecessor. The update underscores the team's commitment to maintaining stability and reliability, even in minor patch versions.

Python 3.13.9 Released: A Targeted Fix for Developers

Unlike standard feature releases, expedited releases like 3.13.9 are triggered by critical issues that disrupt development workflows. In this case, the fix targets a bug in the inspect.getsourcelines function, which is widely used by developers and tools for source code introspection.

The Regression Addressed

The sole fix in Python 3.13.9 is for issue gh-139783: inspect.getsourcelines now correctly handles cases where a decorator is followed by a comment or an empty line. In Python 3.13.8, this scenario caused the function to raise an exception or return incorrect source lines, breaking code that relies on accurate line-level introspection.

This regression likely slipped through due to the complexity of Python's source code parsing, where edge cases involving whitespace and comments can be subtle. The fix restores the expected behavior, ensuring that decorators with trailing comments or blank lines are processed seamlessly.

Impact on Development Workflow

The inspect.getsourcelines function is a vital tool for debugging, testing frameworks (e.g., pytest), IDEs, and static analysis tools. When a decorator is followed by a comment, many developers add comments for clarity (e.g., @decorator # explanation). An empty line after a decorator is also common in formatted code. This regression could cause:

  • Faulty error messages in test runners
  • Incorrect line number mappings in profilers
  • Broken IDE features like “go to definition”

By fixing this specific case, Python 3.13.9 restores reliable introspection for a common coding pattern. Developers who encountered issues in 3.13.8 are strongly encouraged to upgrade.

Comparison with Previous Versions

Python 3.13.9 is identical to 3.13.8 except for the one regression fix. There are no security patches, performance improvements, or new features. The release follows PEP 745, which outlines the 3.13 release schedule and maintenance policy. The expedited nature of this release highlights the Python team's responsiveness to regressions that affect developer productivity.

For reference, Python 3.13.8 was released on [date] and introduced several changes, but this subsequent patch is strictly a quality-of-life fix. Users who skipped 3.13.8 can install 3.13.9 directly without concern.

How to Upgrade and Verify

To upgrade to Python 3.13.9, you can download the installer from the official release page. Alternatively, use a package manager:

  • Linux (apt): sudo apt update && sudo apt install python3.13 (if available in your repo)
  • macOS (Homebrew): brew install python@3.13
  • Windows: Use the installer or winget install Python.Python.3.13

After installation, verify the version with python3.13 --version. To confirm the fix, test the following script:

import inspect

def my_decorator(func):
    return func

@my_decorator  # this comment caused the bug
def my_function():
    pass

lines = inspect.getsourcelines(my_function)
print(lines)  # Should work without error

If you see no exception and the correct source lines, the fix is in place.

Community and Support

The Python Software Foundation (PSF) thanks all volunteers who contribute to Python's development and this release. You can support the community by donating to the PSF or reporting bugs on GitHub.

For detailed information, consult the Python 3.13 documentation and the PEP 745 release schedule.

Release team: Thomas Wouters, Ned Deily, Steve Dower, Łukasz Langa