File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
userbenchmark/dynamo/dynamobench/_dynamo Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -1025,6 +1025,8 @@ def istype(obj: object, allowed_types: Any) -> bool:
1025
1025
if sys .version_info >= (3 , 12 ):
1026
1026
# Some typing classes moved to C in 3.12,
1027
1027
# which no longer have the _Final mixin.
1028
+ # Check for consistency e.g. here:
1029
+ # https://github.com/python/cpython/blob/f2b82b3b3b1f8c7a81e84df35ee921e44517cf32/Lib/typing.py#L32
1028
1030
_builtin_final_typing_classes = (
1029
1031
typing .ParamSpecArgs ,
1030
1032
typing .ParamSpecKwargs ,
@@ -1039,14 +1041,18 @@ def is_typing(value: Any) -> bool:
1039
1041
# _Final catches most of typing classes:
1040
1042
# - Any
1041
1043
# - Callable
1042
- # - Union
1044
+ # - Union (Python < 3.14)
1043
1045
# ...
1044
1046
#
1045
1047
# NB: we intentionally ignore classes that inherit from Generic, since they
1046
1048
# can be used as both TypingVariable as well as UserDefinedClassVariable.
1047
1049
if sys .version_info >= (3 , 12 ) and isinstance (value , _builtin_final_typing_classes ):
1048
1050
return True
1049
- return isinstance (value , typing ._Final ) or value is typing .Generic # type: ignore[attr-defined]
1051
+ return (
1052
+ isinstance (value , typing ._Final ) # type: ignore[attr-defined]
1053
+ or value is typing .Generic
1054
+ or value is typing .Union
1055
+ )
1050
1056
1051
1057
1052
1058
def is_numpy_int_type (value : Any ) -> bool :
You can’t perform that action at this time.
0 commit comments