@@ -574,17 +574,18 @@ def _get_field(cls, a_name, a_type):
574574
575575def _find_fields (cls ):
576576 # Return a list of Field objects, in order, for this class (and no
577- # base classes). Fields are found from __annotations__ (which is
578- # guaranteed to be ordered). Default values are from class
579- # attributes, if a field has a default. If the default value is
580- # a Field(), then it contains additional info beyond (and
581- # possibly including) the actual default value. Pseudo-fields
582- # ClassVars and InitVars are included, despite the fact that
583- # they're not real fields. That's dealt with later.
584-
585- annotations = getattr (cls , '__annotations__' , {})
586- return [_get_field (cls , a_name , a_type )
587- for a_name , a_type in annotations .items ()]
577+ # base classes). Fields are found from the class dict's
578+ # __annotations__ (which is guaranteed to be ordered). Default
579+ # values are from class attributes, if a field has a default. If
580+ # the default value is a Field(), then it contains additional
581+ # info beyond (and possibly including) the actual default value.
582+ # Pseudo-fields ClassVars and InitVars are included, despite the
583+ # fact that they're not real fields. That's dealt with later.
584+
585+ # If __annotations__ isn't present, then this class adds no new
586+ # annotations.
587+ annotations = cls .__dict__ .get ('__annotations__' , {})
588+ return [_get_field (cls , name , type ) for name , type in annotations .items ()]
588589
589590
590591def _set_new_attribute (cls , name , value ):
0 commit comments