Skip to content

(🐞) Same error reported multiple times on inner functions when show-error-context is enabled #13517

Closed
@KotlinIsland

Description

@KotlinIsland

Doubble trouble

def a() -> None:
    def b() -> None:
        1 + ""
        d

    d = 1
main.py: note: In function "a":
main.py:3: error: Unsupported operand types for + ("int" and "str")
main.py: note: In function "b":
main.py:3: error: Unsupported operand types for + ("int" and "str")

playground

Trippple threat

from typing import TypeVar, overload, _T as T

@overload
def deco(fn: T) -> T: ...
@overload
def deco() -> None: ...

def deco(fn=None): ...


def a() -> None:
    def b() -> None:
        1 + ""
        d
    d = 1
    c()


@deco
def c(): ...
main.py: note: In function "a":
main.py:13: error: Unsupported operand types for + ("int" and "str")
main.py: note: In function "b":
main.py:13: error: Unsupported operand types for + ("int" and "str")
main.py: note: In function "a":
main.py:13: error: Unsupported operand types for + ("int" and "str")

playground

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions