Skip to content

Commit

Permalink
Add 312 check to eval annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
EvieePy committed Nov 18, 2024
1 parent a25d91e commit b1db109
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion twitchio/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@
_from_json = json.loads


PY_312 = sys.version_info >= (3, 12)


__all__ = (
"_from_json",
"setup_logging",
Expand Down Expand Up @@ -914,7 +917,7 @@ def evaluate_annotation(
cache[tp] = evaluated
return evaluated

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

0 comments on commit b1db109

Please sign in to comment.