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.
  • 10 commits
  • 22 files changed
  • 5 contributors

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

Commits on Jul 13, 2026

  1. [mypyc] Update documentation of race conditions under free threading (#…

    …21726)
    
    Mypyc now gives additional thread safety guarantees.
    JukkaL committed Jul 13, 2026
    Configuration menu
    Copy the full SHA
    2c21546 View commit details
    Browse the repository at this point in the history
  2. Update changelog for 2.3 release (#21728)

    Release tracking issue: #21717
    JukkaL committed Jul 13, 2026
    Configuration menu
    Copy the full SHA
    4d8ad2a View commit details
    Browse the repository at this point in the history
  3. Drop +dev from version

    JukkaL committed Jul 13, 2026
    Configuration menu
    Copy the full SHA
    8aabf84 View commit details
    Browse the repository at this point in the history

Commits on Aug 15, 2026

  1. Configuration menu
    Copy the full SHA
    a385746 View commit details
    Browse the repository at this point in the history
  2. Fix crash when unpacking return value from overload (#21830)

    Fixes #21824
    Fixes #19920
    Closes #19921
    
    Note that ilevkivskyi has a suggestion to change overload inference
    here:
    #19920 (comment)
    
    While that is right, it is a little separate, and I think it is okay to
    remove the crash given that it now affects numpy and has been reported
    in other contexts too. We just keep the originally inferred tuple
    hauntsaninja committed Aug 15, 2026
    Configuration menu
    Copy the full SHA
    6dfa06d View commit details
    Browse the repository at this point in the history
  3. [mypyc] Clear coroutine env on coroutine completion (#21734)

    The `env_class` object associated with a mypyc coroutine is not
    immediately cleared when the coroutine completes. This can significantly
    increase memory usage, since the env class may hold references to
    captured locals and values spilled across suspension points.
    
    The objects are eventually collectible by the GC but the collection
    might be delayed in cases where a nested coroutine is awaited, eg.
    
    ```python
    async def allocate(size: int) -> None:
        payload = bytearray(size)
    
        async def nested() -> int:
            return payload[-1]
    
        assert await nested() == 0
    ```
    
    With nesting mypyc creates env classes for both `allocate` and `nested`
    that may reference each other and form a cycle.
    
    To fix this, clear the `env_class` immediately after the coroutine
    completes. This matches behavior of cpython, which clears frames of
    completed coroutines immediately in the eval loop.
    p-sawicki authored and hauntsaninja committed Aug 15, 2026
    Configuration menu
    Copy the full SHA
    14f5df9 View commit details
    Browse the repository at this point in the history
  4. [mypyc] Fix default_factory for inherited dataclass (#21785)

    Closes mypyc/mypyc#1204, a `mypyc` issue.
    
    The issue likely unblocks `isort` from being compiled with `mypyc`,
    which is why I took an interest it. Full disclosure is that I used AI to
    write this, it provided this test and code just from the linked issue
    but it looks sensible to me. I did not use additional prompting. Like I
    said, fix looks sensible: we now call `dataclass_type` for each entry in
    the MRO, instead of once.
    
    I am aware the contributing guidelines say new contributors are not
    encourage to use LLMs but I hope the size of the PR and my track record
    as open source maintainer gives some flexibility here. I'm very aware
    that reviewing AI written PRs creates maintainer burden, but I'm
    committed to getting this over the finish line. To that end I:
    
    Tested locally with `pytest mypyc/test/test_run.py ` and that looked
    okay.
    Also tested that without the changes the added test would fail on
    `master`.
    Also tried to run CI on my local fork
    (DanielNoord#1), which succeeded.
    
    Feel free to push changes to the branch or cherry pick this into another
    branch. I am not necessarily interested in getting credits for the
    fix/PR, I'd just like to continue with my attempt to get `isort`
    compiled and for that I need this in a `mypy` release :)
    DanielNoord authored and hauntsaninja committed Aug 15, 2026
    Configuration menu
    Copy the full SHA
    4843e77 View commit details
    Browse the repository at this point in the history
  5. [mypyc] Fix crash on double yielding Iterators (#21826)

    Closes mypyc/mypyc#1210
    
    This fixes another issue I ran into while trying to use `mypyc` for
    `isort`.
    
    I am aware the contributing guidelines say new contributors are not
    encouraged to use LLMs but I hope this can get the same handling as
    #21785. I have tried to ensure this
    patch works as much as I can by:
    
    Testing locally with `pytest mypyc/test/test_run.py `.
    Tested that the test fails on `master` without the changes.
    Also tried to run CI on my local fork
    (DanielNoord#2), which succeeded.
    
    As with the previous PR, feel free to push changes to the branch or
    cherry pick this into another branch. I just want to unblock `isort` :)
    DanielNoord authored and hauntsaninja committed Aug 15, 2026
    Configuration menu
    Copy the full SHA
    a392429 View commit details
    Browse the repository at this point in the history
  6. Bump version to 2.3.1

    hauntsaninja committed Aug 15, 2026
    Configuration menu
    Copy the full SHA
    d642c44 View commit details
    Browse the repository at this point in the history
Loading