Skip to content

Commit 6b7df06

Browse files
Fix Literal labeling in Python 3.8 and 3.9.
1 parent e82beb5 commit 6b7df06

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

spec_classes/utils/type_checking.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def type_label(attr_type: Type) -> str:
148148
method general.
149149
"""
150150
if hasattr(attr_type, "__origin__"): # Generics
151-
if attr_type.__origin__ is Literal:
151+
if str(attr_type.__origin__).rsplit(".", 1)[-1] == "Literal":
152152
return f"Literal[{', '.join(repr(arg) for arg in attr_type.__args__)}]"
153153
label = type_label(attr_type.__origin__)
154154
if hasattr(attr_type, "__args__") and not any(

0 commit comments

Comments
 (0)