diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-07-17 21:10:21 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-17 21:10:21 (GMT) |
commit | 03aad3049d1591c76a219dfe089e5367f88f167e (patch) | |
tree | 175acc35bac01a1cf8c7ef160096cc33f2e0064f /Objects/abstract.c | |
parent | 2d055ce13250a4074f66a945381a149a3cf8c46f (diff) | |
download | cpython-03aad3049d1591c76a219dfe089e5367f88f167e.zip cpython-03aad3049d1591c76a219dfe089e5367f88f167e.tar.gz cpython-03aad3049d1591c76a219dfe089e5367f88f167e.tar.bz2 |
[3.10] bpo-44654: Refactor and clean up the union type implementation (GH-27196) (GH-27219)
(cherry picked from commit 0fd27375cabd12e68a2f12cfeca11a2d5043429e)
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; |