-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
isinstance erases type info #12949
Copy link
Copy link
Closed
Labels
bugmypy got something wrongmypy got something wrongtopic-type-narrowingConditional type narrowing / binderConditional type narrowing / bindertopic-type-variables
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongtopic-type-narrowingConditional type narrowing / binderConditional type narrowing / bindertopic-type-variables
Fields
Give feedbackNo fields configured for issues without a type.
Bug Report
Accessing a variable of a generic type after an
if isinstance()against a (non-generic) subclass of said type changes the variable's type to<nothing>within theisinstanceclause scope:Expected Behavior
No error.
Actual Behavior
Your Environment