Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conditional import of typing_extensions gives "Incompatible import" #9856

Description

@Dreamsorcerer

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions