diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2021-07-17 19:44:10 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-17 19:44:10 (GMT) |
commit | 0fd27375cabd12e68a2f12cfeca11a2d5043429e (patch) | |
tree | acb748d0bc66167f6f0d6d30123a205fc5af3e9b /Objects/abstract.c | |
parent | f88e138a1aa3b9a9e013963e4fd7d5cce6a0b85c (diff) | |
download | cpython-0fd27375cabd12e68a2f12cfeca11a2d5043429e.zip cpython-0fd27375cabd12e68a2f12cfeca11a2d5043429e.tar.gz cpython-0fd27375cabd12e68a2f12cfeca11a2d5043429e.tar.bz2 |
bpo-44654: Refactor and clean up the union type implementation (GH-27196)
Diffstat (limited to 'Objects/abstract.c')
-rw-r--r-- | Objects/abstract.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c index fcfe2db..f14a923 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -6,7 +6,7 @@ #include "pycore_object.h" // _Py_CheckSlotResult() #include "pycore_pyerrors.h" // _PyErr_Occurred() #include "pycore_pystate.h" // _PyThreadState_GET() -#include "pycore_unionobject.h" // _Py_UnionType && _Py_Union() +#include "pycore_unionobject.h" // _PyUnion_Check() #include <ctype.h> #include <stddef.h> // offsetof() #include "longintrepr.h" @@ -2623,9 +2623,7 @@ recursive_issubclass(PyObject *derived, PyObject *cls) "issubclass() arg 1 must be a class")) return -1; - PyTypeObject *type = Py_TYPE(cls); - int is_union = (PyType_Check(type) && type == &_Py_UnionType); - if (!is_union && !check_class(cls, + if (!_PyUnion_Check(cls) && !check_class(cls, "issubclass() arg 2 must be a class," " a tuple of classes, or a union.")) { return -1; |