-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Comparing changes
Open a pull request
base repository: python/mypy
base: 358a3b5
head repository: python/mypy
compare: d642c44
- 10 commits
- 22 files changed
- 5 contributors
Commits on Jul 10, 2026
-
[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.
Configuration menu - View commit details
-
Copy full SHA for a9f62a3 - Browse repository at this point
Copy the full SHA a9f62a3View commit details
Commits on Jul 13, 2026
-
[mypyc] Update documentation of race conditions under free threading (#…
…21726) Mypyc now gives additional thread safety guarantees.
Configuration menu - View commit details
-
Copy full SHA for 2c21546 - Browse repository at this point
Copy the full SHA 2c21546View commit details -
Update changelog for 2.3 release (#21728)
Release tracking issue: #21717
Configuration menu - View commit details
-
Copy full SHA for 4d8ad2a - Browse repository at this point
Copy the full SHA 4d8ad2aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 8aabf84 - Browse repository at this point
Copy the full SHA 8aabf84View commit details
Commits on Aug 15, 2026
-
Configuration menu - View commit details
-
Copy full SHA for a385746 - Browse repository at this point
Copy the full SHA a385746View commit details -
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
Configuration menu - View commit details
-
Copy full SHA for 6dfa06d - Browse repository at this point
Copy the full SHA 6dfa06dView commit details -
[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.Configuration menu - View commit details
-
Copy full SHA for 14f5df9 - Browse repository at this point
Copy the full SHA 14f5df9View commit details -
[mypyc] Fix
default_factoryfor 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 :)
Configuration menu - View commit details
-
Copy full SHA for 4843e77 - Browse repository at this point
Copy the full SHA 4843e77View commit details -
[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` :)
Configuration menu - View commit details
-
Copy full SHA for a392429 - Browse repository at this point
Copy the full SHA a392429View commit details -
Configuration menu - View commit details
-
Copy full SHA for d642c44 - Browse repository at this point
Copy the full SHA d642c44View commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff 358a3b5...d642c44