cpython/Objects/unionobject.c

// 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, _Py_typing_type_repr
#include "pycore_unionobject.h"


static PyObject *make_union(PyObject *);


unionobject;

static void
unionobject_dealloc(PyObject *self)
{}

static int
union_traverse(PyObject *self, visitproc visit, void *arg)
{}

static Py_hash_t
union_hash(PyObject *self)
{}

static PyObject *
union_richcompare(PyObject *a, PyObject *b, int op)
{}

static int
is_same(PyObject *left, PyObject *right)
{}

static int
contains(PyObject **items, Py_ssize_t size, PyObject *obj)
{}

static PyObject *
merge(PyObject **items1, Py_ssize_t size1,
      PyObject **items2, Py_ssize_t size2)
{}

static PyObject **
get_types(PyObject **obj, Py_ssize_t *size)
{}

static int
is_unionable(PyObject *obj)
{}

PyObject *
_Py_union_type_or(PyObject* self, PyObject* other)
{}

static PyObject *
union_repr(PyObject *self)
{}

static PyMemberDef union_members[] =;

static PyObject *
union_getitem(PyObject *self, PyObject *item)
{}

static PyMappingMethods union_as_mapping =;

static PyObject *
union_parameters(PyObject *self, void *Py_UNUSED(unused))
{}

static PyGetSetDef union_properties[] =;

static PyNumberMethods union_as_number =;

static const char* const cls_attrs[] =;

static PyObject *
union_getattro(PyObject *self, PyObject *name)
{}

PyObject *
_Py_union_args(PyObject *self)
{}

PyTypeObject _PyUnion_Type =;

static PyObject *
make_union(PyObject *args)
{}