bpo-44632: Fix support of TypeVar in the union type (GH-27139) (GH-27143)
int | TypeVar('T') returns now an instance of types.Union
instead of typing.Union.
(cherry picked from commit a158b20019b50e3ece6e4743ec4e6ae8d818b690)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
diff --git a/Objects/unionobject.c b/Objects/unionobject.c
index 98db27d..229b518 100644
--- a/Objects/unionobject.c
+++ b/Objects/unionobject.c
@@ -124,7 +124,7 @@ is_typing_name(PyObject *obj, char *name)
if (strcmp(type->tp_name, name) != 0) {
return 0;
}
- return is_typing_module(obj);
+ return is_typing_module((PyObject *)type);
}
static PyObject *