File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -578,8 +578,13 @@ def _unpatch_attribute(patched: PatchedAttribute) -> None:
578578
579579
580580def _extract_marker (parameter : inspect .Parameter ) -> Optional ["_Marker" ]:
581- if get_origin (parameter .annotation ) is Annotated :
582- marker = get_args (parameter .annotation )[1 ]
581+ is_annotated = (
582+ isinstance (annotation , type (Annotated ))
583+ and get_origin (annotation ) is not None
584+ and get_origin (annotation ) is get_origin (Annotated )
585+ )
586+ if is_annotated :
587+ marker = get_args (annotation )[1 ]
583588 else :
584589 marker = parameter .default
585590
@@ -1034,7 +1039,12 @@ def _get_members_and_annotated(obj: Any) -> Iterable[Tuple[str, Any]]:
10341039 except Exception :
10351040 annotations = {}
10361041 for annotation_name , annotation in annotations .items ():
1037- if get_origin (annotation ) is Annotated :
1042+ is_annotated = (
1043+ isinstance (annotation , type (Annotated ))
1044+ and get_origin (annotation ) is not None
1045+ and get_origin (annotation ) is get_origin (Annotated )
1046+ )
1047+ if is_annotated :
10381048 args = get_args (annotation )
10391049 if len (args ) > 1 :
10401050 member = args [1 ]
You can’t perform that action at this time.
0 commit comments