diff options
Diffstat (limited to 'Objects/typeobject.c')
-rw-r--r-- | Objects/typeobject.c | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index fabdd9d..8c49096 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -586,14 +586,6 @@ type___instancecheck__(PyObject *type, PyObject *inst) static PyObject * -type_get_instancecheck(PyObject *type, void *context) -{ - static PyMethodDef ml = {"__instancecheck__", - type___instancecheck__, METH_O }; - return PyCFunction_New(&ml, type); -} - -static PyObject * type___subclasscheck__(PyObject *type, PyObject *inst) { switch (_PyObject_RealIsSubclass(inst, type)) { @@ -606,13 +598,6 @@ type___subclasscheck__(PyObject *type, PyObject *inst) } } -static PyObject * -type_get_subclasscheck(PyObject *type, void *context) -{ - static PyMethodDef ml = {"__subclasscheck__", - type___subclasscheck__, METH_O }; - return PyCFunction_New(&ml, type); -} static PyGetSetDef type_getsets[] = { {"__name__", (getter)type_name, (setter)type_set_name, NULL}, @@ -622,8 +607,6 @@ static PyGetSetDef type_getsets[] = { (setter)type_set_abstractmethods, NULL}, {"__dict__", (getter)type_dict, NULL, NULL}, {"__doc__", (getter)type_get_doc, NULL, NULL}, - {"__instancecheck__", (getter)type_get_instancecheck, NULL, NULL}, - {"__subclasscheck__", (getter)type_get_subclasscheck, NULL, NULL}, {0} }; @@ -2674,6 +2657,10 @@ static PyMethodDef type_methods[] = { PyDoc_STR("mro() -> list\nreturn a type's method resolution order")}, {"__subclasses__", (PyCFunction)type_subclasses, METH_NOARGS, PyDoc_STR("__subclasses__() -> list of immediate subclasses")}, + {"__instancecheck__", type___instancecheck__, METH_O, + PyDoc_STR("__instancecheck__() -> check if an object is an instance")}, + {"__subclasscheck__", type___subclasscheck__, METH_O, + PyDoc_STR("__subclasschck__ -> check if an class is a subclass")}, {0} }; |