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: unpack-kwargs-only
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 11 files changed
  • 2 contributors

Commits on Feb 3, 2026

  1. Implement Unpack of TypeVars for **kwargs inference

    Allow `**kwargs: Unpack[K]` where K is a TypeVar bound to TypedDict.
    This enables inferring TypedDict types from keyword arguments at call sites.
    
    Example:
        def f[K: BaseTypedDict](**kwargs: Unpack[K]) -> K: ...
        result = f(x=1, y="hello")  # K inferred as TypedDict({'x': int, 'y': str})
    
    Changes:
    - semanal.py: Accept TypeVar with TypedDict bound in remove_unpack_kwargs(),
      keep UnpackType for constraint inference
    - semanal_typeargs.py: Allow TypeVar with TypedDict bound in visit_unpack_type()
    - constraints.py: Generate TypedDict constraints from actual kwargs
    - types.py: Handle TypeVar in with_unpacked_kwargs()
    - checkexpr.py: Re-expand kwargs after TypeVar inference
    
    Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
    msullivan and claude committed Feb 3, 2026
    Configuration menu
    Copy the full SHA
    c277924 View commit details
    Browse the repository at this point in the history
Loading