Skip to content

Function argument rejected as a base class #5865

@JukkaL

Description

@JukkaL

Class D in the example below is rejected, even though class E, which looks very similar, is accepted:

from typing import Any

a: Any
class C(a): pass  # Ok

def f(b: Any) -> None:
    class D(b): pass  # Errors: Invalid type "b"; Invalid base class

def g(c: Any) -> None:
    d: Any = c
    class E(d): pass  # Ok

The above example shouldn't generate errors.

(Originally reported by @germaniumhq in #2477 (comment).)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions