Skip to content

Unsupported operand types for + ("list[None]" and "list[str]") #19413

Open
@randolf-scholz

Description

@randolf-scholz

To Reproduce

from typing import Iterable

def prod[T](iter1: Iterable[T]) -> Iterable[tuple[T]]:
    return ((x,) for x in iter1)

x: list[str] = ["a", "b", "c"]
prod([None] + x)  # false positive [operator]

https://mypy-play.net/?mypy=master&python=3.12&gist=390f48f0541325d872d9cb419e3a5f20

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions