File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -971,24 +971,21 @@ def _get_expanded_attr_types(
971971 parent_typ : ProperType ,
972972) -> list [Mapping [str , Type ]] | None :
973973 """
974- For a given type, determine what attrs classes it can be, and return the field types for each class .
974+ For a given type, determine what attrs classes it can be: for each class, return the field types.
975975 For generic classes, the field types are expanded.
976976 If the type contains Any or a non-attrs type, returns None; in the latter case, also reports an error.
977977 """
978978 if isinstance (typ , AnyType ):
979979 return None
980980 if isinstance (typ , UnionType ):
981981 types = []
982- had_errors = False
983982 for item in typ .relevant_items ():
984983 item = get_proper_type (item )
985984 item_types = _get_expanded_attr_types (ctx , item , item , parent_typ )
986- if isinstance ( item_types , list ) :
985+ if types is not None and item_types is not None :
987986 types += item_types
988987 else :
989- had_errors = True
990- if had_errors :
991- return None
988+ types = None # but keep iterating to emit all errors
992989 return types
993990 if isinstance (typ , TypeVarType ):
994991 return _get_expanded_attr_types (
You can’t perform that action at this time.
0 commit comments