summaryrefslogtreecommitdiff
path: root/Objects/typeobject.c
diff options
context:
space:
mode:
authorkj <28750310+Fidget-Spinner@users.noreply.github.com>2020-11-09 12:00:13 +0800
committerGitHub <noreply@github.com>2020-11-08 20:00:13 -0800
commit4eb41d055e8307b8206f680287e492a6db068acd (patch)
tree49f5dd4d1abac0b43945310972a97e0c943d2869 /Objects/typeobject.c
parent23831a7a90956e38b7d70304bb6afe30d37936de (diff)
downloadcpython-git-4eb41d055e8307b8206f680287e492a6db068acd.tar.gz
bpo-42233: Add union type expression support for GenericAlias and fix de-duplicating of GenericAlias (GH-23077)
Diffstat (limited to 'Objects/typeobject.c')
-rw-r--r--Objects/typeobject.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 3822b8cf81..55bf9b3f38 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -6,7 +6,7 @@
#include "pycore_object.h"
#include "pycore_pyerrors.h"
#include "pycore_pystate.h" // _PyThreadState_GET()
-#include "pycore_unionobject.h" // _Py_Union()
+#include "pycore_unionobject.h" // _Py_Union(), _Py_union_type_or
#include "frameobject.h"
#include "structmember.h" // PyMemberDef
@@ -3789,19 +3789,9 @@ type_is_gc(PyTypeObject *type)
return type->tp_flags & Py_TPFLAGS_HEAPTYPE;
}
-static PyObject *
-type_or(PyTypeObject* self, PyObject* param) {
- PyObject *tuple = PyTuple_Pack(2, self, param);
- if (tuple == NULL) {
- return NULL;
- }
- PyObject *new_union = _Py_Union(tuple);
- Py_DECREF(tuple);
- return new_union;
-}
static PyNumberMethods type_as_number = {
- .nb_or = (binaryfunc)type_or, // Add __or__ function
+ .nb_or = _Py_union_type_or, // Add __or__ function
};
PyTypeObject PyType_Type = {