File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -1268,18 +1268,20 @@ def verify_var(
12681268 runtime_type = get_mypy_type_of_runtime_value (runtime .value )
12691269 if runtime_type is not None and is_subtype_helper (runtime_type , stub .type ):
12701270 should_error = False
1271- # We always allow setting the stub value to ...
1271+ # We always allow setting the stub value to Ellipsis (...), but use
1272+ # _value_ type as a fallback if given. If a member is ... and _value_
1273+ # type is given, all runtime types should be assignable to _value_.
12721274 proper_type = mypy .types .get_proper_type (stub .type )
12731275 if (
12741276 isinstance (proper_type , mypy .types .Instance )
12751277 and proper_type .type .fullname in mypy .types .ELLIPSIS_TYPE_NAMES
12761278 ):
12771279 value_t = stub .info .get ("_value_" )
1278- if value_t is None or value_t .type is None :
1280+ if value_t is None or value_t .type is None or runtime_type is None :
12791281 should_error = False
1280- elif runtime_type is not None and is_subtype_helper (runtime_type , value_t .type ):
1282+ elif is_subtype_helper (runtime_type , value_t .type ):
12811283 should_error = False
1282- elif runtime_type is not None :
1284+ else :
12831285 note = " (incompatible '_value_')"
12841286
12851287 if should_error :
You can’t perform that action at this time.
0 commit comments