mirror of
https://github.com/python/cpython.git
synced 2025-12-31 04:23:37 +00:00
bpo-44654: Refactor and clean up the union type implementation (GH-27196)
This commit is contained in:
parent
f88e138a1a
commit
0fd27375ca
9 changed files with 88 additions and 125 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue