Skip to content

Allow the use of types.ModuleType #3106

@pkch

Description

@pkch

Based on this SO question, I tried this code:

import types
def f() -> types.ModuleType:
    return types

and it failed type check with Incompatible return value type (got "module", expected "ModuleType"). I think names exported in types.* are appropriate for cases like this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions