Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: python/mypy
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: python/mypy
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: release-2.3
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 9 files changed
  • 1 contributor

Commits on Jul 10, 2026

  1. [mypyc] Make attribute access memory safe on free-threaded builds (#2…

    …1705)
    
    This fixes memory unsafety when there is a race condition related to
    attribute get/set operations on a free-threaded build, for simple
    reference-based attributes only (`PyObject *`). This includes attributes
    with primitive types like `list`, `set` and `str` and `dict`, and native
    class types.
    
    The main idea is to use delayed decref for the old attribute value when
    assigning to an attribute. There are detailed comments explaining the
    approach in detail.
    
    This causes a ~5% slowdown in self check when using 3.14t. Currently it
    looks like a significant perf cost is unavoidable if we want to fix
    memory unsafety, but we can further optimize mypy to reduce the impact
    by introducing final attributes, for example.
    
    Remaining work includes fixing attributes with fixed-length tuple types
    and tagged integer types (in follow-up PRs).
    
    I used coding agent assist heavily.
    
    Work on mypyc/mypyc#1203.
    JukkaL committed Jul 10, 2026
    Configuration menu
    Copy the full SHA
    a9f62a3 View commit details
    Browse the repository at this point in the history
Loading