Skip to content

Conditional import of typing_extensions gives "Incompatible import" #9856

Closed
@Dreamsorcerer

Description

When doing:

try:
    from typing import Final
except ImportError:
    from typing_extensions import Final

We get:

error: Incompatible import of "Final" (imported name has type "typing_extensions._SpecialForm", local name has type "typing._SpecialForm")

Unless I'm mistaken, this is a common pattern for supporting older Python versions. Therefore, it would ideally not trigger these errors, even if it has to be special cased.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions