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: vercel/python-typemap
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: vercel/python-typemap
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: map
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 4 commits
  • 20 files changed
  • 1 contributor

Commits on Apr 17, 2026

  1. Replace *[comprehension] with *Map(comprehension) for type-level iter…

    …ation
    
    Map is a new operator that wraps the comprehension and will eventually
    support different semantics (e.g. propagating Any). For now it behaves
    identically to the bare list comprehension. Mypy tests for files that
    use Map are xfailed until the stubs are updated.
    msullivan committed Apr 17, 2026
    Configuration menu
    Copy the full SHA
    c6c2e6b View commit details
    Browse the repository at this point in the history
  2. Collapse tuple[*Map(... for _ in Iter[Any])] to Any

    Iter[Any] now returns a generator that raises IterAnyError on first
    __next__ (not __iter__, which CPython calls eagerly when constructing a
    genexpr -- before Map can wrap it). Map catches IterAnyError via
    `yield from` and yields a _UnpackAny sentinel, which callers of
    _eval_args short-circuit into typing.Any.
    msullivan committed Apr 17, 2026
    Configuration menu
    Copy the full SHA
    2ad7211 View commit details
    Browse the repository at this point in the history
  3. Defer Map iteration from __iter__ to the evaluator

    Map.__iter__ now just yields an (_UnpackedMap, _UnpackedMapEnd) pair; the
    evaluator drives the wrapped generator inside _eval_args, catches
    IterAnyError there, and emits _UnpackAny. The trailing sentinel keeps
    Union[*Map(...)] from collapsing to a single arg before _eval_union can
    see it. IterAnyError is now a TypeMapError subclass, living entirely
    inside the evaluator.
    
    _eval_args iterates the generator one value at a time so that nested
    genexprs closing over the outer iteration variable don't all see its
    final value. _eval_union now routes through _eval_args too.
    msullivan committed Apr 17, 2026
    Configuration menu
    Copy the full SHA
    d99f356 View commit details
    Browse the repository at this point in the history
  4. Extract _eval_and_append helper in _eval_args

    Both the _UnpackedMap branch and the plain-arg branch did the same
    eval-and-unpack dance; pull it out.
    msullivan committed Apr 17, 2026
    Configuration menu
    Copy the full SHA
    c2975ab View commit details
    Browse the repository at this point in the history
Loading