Skip to content

Commit eb9cccf

Browse files
committed
Fix self check
1 parent 0afc115 commit eb9cccf

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

mypy/plugins/attrs.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -1063,8 +1063,9 @@ def evolve_function_sig_callback(ctx: mypy.plugin.FunctionSigContext) -> Callabl
10631063

10641064

10651065
def _get_cls_from_init(t: Type) -> TypeInfo | None:
1066-
if isinstance(t, CallableType):
1067-
return t.type_object()
1066+
proper_type = get_proper_type(t)
1067+
if isinstance(proper_type, CallableType):
1068+
return proper_type.type_object()
10681069
return None
10691070

10701071

@@ -1077,7 +1078,8 @@ def fields_function_callback(ctx: FunctionContext) -> Type:
10771078
if MAGIC_ATTR_NAME in cls.names:
10781079
# This is a proper attrs class.
10791080
ret_type = cls.names[MAGIC_ATTR_NAME].type
1080-
return ret_type
1081+
if ret_type is not None:
1082+
return ret_type
10811083
else:
10821084
ctx.api.fail(
10831085
f'Argument 1 to "fields" has incompatible type "{format_type_bare(first_arg_type)}"; expected an attrs class',

0 commit comments

Comments
 (0)