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: v1.20.1
Choose a base ref
...
head repository: python/mypy
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.20.2
Choose a head ref
  • 11 commits
  • 26 files changed
  • 5 contributors

Commits on Apr 21, 2026

  1. Bump version to 1.20.2+dev

    JukkaL committed Apr 21, 2026
    Configuration menu
    Copy the full SHA
    27096ba View commit details
    Browse the repository at this point in the history
  2. Use WAL with SQLite cache, fix close (#21154)

    This is the more modern way to manage concurrency with SQLite. Relevant
    to current discussion, it means concurrent mypy runs using the cache
    will wait for each other, rather than fail
    
    SQLite also claims this is significantly faster, but I haven't yet done
    a good profile (If you are profiling this, note that WAL is a persistent
    setting, so you will want to delete the cache). This might also allow
    removing the `PRAGMA synchronous=OFF`
    
    Finally, I also explicitly close the connection in main. This is
    relevant to this change, because it forces checkpointing of the WAL,
    which keeps reads fast, reduces disk space and means the cache.db
    remains a single self-contained file under regular use
    
    Fixes #21136, see also discussion in #13916
    
    For what it's worth, I feel there are many legitimate uses of concurrent
    mypy. At work, we often share cache between multiple projects. At home,
    I often end up having parallel runs with a debugger while working on
    mypy (although this PR just makes those ones hang waiting for the lock
    lol)
    
    ---------
    
    Co-authored-by: Ivan Levkivskyi <[email protected]>
    2 people authored and JukkaL committed Apr 21, 2026
    Configuration menu
    Copy the full SHA
    79a3ec6 View commit details
    Browse the repository at this point in the history
  3. Only set journal mode in coordinator (#21217)

    This should reduce test flakiness (esp. on Windows). IIUC
    this setting is per database, so setting it only in coordinator (main
    process) should be enough.
    ilevkivskyi authored and JukkaL committed Apr 21, 2026
    Configuration menu
    Copy the full SHA
    c34530e View commit details
    Browse the repository at this point in the history
  4. Correctly aggregate narrowing information on parent expressions (#21206)

    Fixes #21204 , fixes #20596
    
    The extra narrowing we perform in mypy 1.20 exposes this much longer
    standing issue
    hauntsaninja authored and JukkaL committed Apr 21, 2026
    Configuration menu
    Copy the full SHA
    210f518 View commit details
    Browse the repository at this point in the history
  5. Fix is_overlapping_types for generic callables (#21208)

    Fixes #21182
    
    This issue exposed this pre-existing deficiency in is_overlapping_types
    hauntsaninja authored and JukkaL committed Apr 21, 2026
    Configuration menu
    Copy the full SHA
    0dcbfaa View commit details
    Browse the repository at this point in the history
  6. Avoid widening types in conditional_types (#21242)

    Fixes #21181
    
    Another pre-existing issue exposed by narrowing improvements
    hauntsaninja authored and JukkaL committed Apr 21, 2026
    Configuration menu
    Copy the full SHA
    92b74f2 View commit details
    Browse the repository at this point in the history
  7. Fix match statement semantics for "or" pattern (#21156)

    Fixes mypyc/mypyc#1166
    
    Authored by Codex
    hauntsaninja authored and JukkaL committed Apr 21, 2026
    Configuration menu
    Copy the full SHA
    7b0e09f View commit details
    Browse the repository at this point in the history
  8. Initial support for Python 3.15.0a8 (#21255)

    Some minor changes to be able to compile mypy with mypyc on Python
    3.15.0a8.
    
    - Update `typing-extensions` to `>=4.14.0` for Python `>=3.15` due to
    the removal of `typing.no_type_check_decorator`
    python/cpython#133601
    
    https://docs.python.org/3/library/typing.html#typing.no_type_check_decorator
    https://github.com/python/typing_extensions/blob/4.14.0/CHANGELOG.md
    - `TypeAliasType.__qualname__` was added in
    python/cpython#139817
    - Some new FutureWarnings for b64_decode
    python/cpython#125346
    python/cpython#141128
    cdce8p authored and JukkaL committed Apr 21, 2026
    Configuration menu
    Copy the full SHA
    ba28610 View commit details
    Browse the repository at this point in the history
  9. [mypyc] Set dunder attrs when adding module to sys.modules (#21275)

    Recently there was a change to add native modules to `sys.modules`
    before they are executed to be able to detect circular imports. This
    introduced a regression when the module is a package that imports
    objects from other files within the package, eg. `from pkg.file import
    something` inside `pkg/__init__.py`. Such imports result in an exception
    `ModuleNotFoundError: No module named 'pkg.file'; 'pkg' is not a
    package.`, for example when trying to upgrade mypy in
    [black](https://github.com/psf/black/actions/runs/23933086642/job/69803937853?pr=5071).
    
    This error is raised because Python expects the parent module of `file`
    to have the `__path__` attribute set when [resolving the
    import](https://github.com/python/cpython/blob/main/Lib/importlib/_bootstrap.py#L1226)
    but we don't set this attribute before adding the `pkg` module to
    `sys.modules`.
    
    So use existing functions to set relevant dunder attributes (`__path__`
    for packages and `__file__`, `__spec__`, and `__package__` for all)
    before registering the module in `sys.modules`.
    
    Don't skip compilation for `__init__.py` files in separate compilation
    mode to make this possible to test.
    
    Use `Py_CLEAR` instead of `Py_DECREF` on the import object on failure in
    `CPyImport_ImportNative` as the import object might be freed when
    deleting it from `sys.modules`. This triggered an assertion when running
    tests with a debug build of cpython.
    p-sawicki authored and JukkaL committed Apr 21, 2026
    Configuration menu
    Copy the full SHA
    908d344 View commit details
    Browse the repository at this point in the history
  10. Fix slicing with nonstrict optional (#21282)

    Fixes #21261
    
    I didn't add a regression test because you need custom fixtures and I
    just don't think any nonstrict optional change is worth the trouble
    hauntsaninja authored and JukkaL committed Apr 21, 2026
    Configuration menu
    Copy the full SHA
    81cd492 View commit details
    Browse the repository at this point in the history
  11. Bump version to 1.20.2

    JukkaL committed Apr 21, 2026
    Configuration menu
    Copy the full SHA
    145a062 View commit details
    Browse the repository at this point in the history
Loading