Skip to content

Commit b1db109

Browse files
committed
Add 312 check to eval annotations
1 parent a25d91e commit b1db109

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

twitchio/utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@
5757
_from_json = json.loads
5858

5959

60+
PY_312 = sys.version_info >= (3, 12)
61+
62+
6063
__all__ = (
6164
"_from_json",
6265
"setup_logging",
@@ -914,7 +917,7 @@ def evaluate_annotation(
914917
cache[tp] = evaluated
915918
return evaluated
916919

917-
if getattr(tp.__repr__, "__objclass__", None) is typing.TypeAliasType: # type: ignore
920+
if PY_312 and getattr(tp.__repr__, "__objclass__", None) is typing.TypeAliasType: # type: ignore
918921
temp_locals = dict(**locals, **{t.__name__: t for t in tp.__type_params__}) # type: ignore
919922
annotation = evaluate_annotation(tp.__value__, globals, temp_locals, cache.copy()) # type: ignore
920923
if hasattr(tp, "__args__"):

0 commit comments

Comments
 (0)