File tree 1 file changed +13
-3
lines changed
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:
578
578
579
579
580
580
def _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 ]
583
588
else :
584
589
marker = parameter .default
585
590
@@ -1034,7 +1039,12 @@ def _get_members_and_annotated(obj: Any) -> Iterable[Tuple[str, Any]]:
1034
1039
except Exception :
1035
1040
annotations = {}
1036
1041
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 :
1038
1048
args = get_args (annotation )
1039
1049
if len (args ) > 1 :
1040
1050
member = args [1 ]
You can’t perform that action at this time.
0 commit comments