summaryrefslogtreecommitdiffstats
path: root/Objects/unionobject.c
diff options
context:
space:
mode:
authorJelle Zijlstra <jelle.zijlstra@gmail.com>2023-05-18 22:56:15 (GMT)
committerGitHub <noreply@github.com>2023-05-18 22:56:15 (GMT)
commitb9dce3aec46bf5190400bd8239fdd4ea9e64d674 (patch)
treedc4e08c00d835d3f45b66e5be4b73df0d94ddbe3 /Objects/unionobject.c
parent1c55e8d00728ceabd97cd1a5bd4906c9875a80c6 (diff)
downloadcpython-b9dce3aec46bf5190400bd8239fdd4ea9e64d674.zip
cpython-b9dce3aec46bf5190400bd8239fdd4ea9e64d674.tar.gz
cpython-b9dce3aec46bf5190400bd8239fdd4ea9e64d674.tar.bz2
gh-104549: Set __module__ on TypeAliasType (#104550)
Diffstat (limited to 'Objects/unionobject.c')
-rw-r--r--Objects/unionobject.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Objects/unionobject.c b/Objects/unionobject.c
index 9806678..f509a16 100644
--- a/Objects/unionobject.c
+++ b/Objects/unionobject.c
@@ -1,6 +1,7 @@
// types.UnionType -- used to represent e.g. Union[int, str], int | str
#include "Python.h"
#include "pycore_object.h" // _PyObject_GC_TRACK/UNTRACK
+#include "pycore_typevarobject.h" // _PyTypeAlias_Type
#include "pycore_unionobject.h"
#include "structmember.h"
@@ -150,11 +151,11 @@ is_unionable(PyObject *obj)
if (obj == Py_None ||
PyType_Check(obj) ||
_PyGenericAlias_Check(obj) ||
- _PyUnion_Check(obj)) {
+ _PyUnion_Check(obj) ||
+ Py_IS_TYPE(obj, &_PyTypeAlias_Type)) {
return 1;
}
- PyInterpreterState *interp = PyInterpreterState_Get();
- return Py_IS_TYPE(obj, interp->cached_objects.typealias_type);
+ return 0;
}
PyObject *