diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-05-16 21:55:24 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-05-16 21:55:24 (GMT) |
commit | 88fe5f9776bca1dee330a76776f831e12ea8b36d (patch) | |
tree | f7c1eecb1fdde9693dcb13a68fa0509b9010c8b3 /Objects/typeobject.c | |
parent | 188789d8f445f9d7a4885025a7885b0f50c593a6 (diff) | |
download | cpython-88fe5f9776bca1dee330a76776f831e12ea8b36d.zip cpython-88fe5f9776bca1dee330a76776f831e12ea8b36d.tar.gz cpython-88fe5f9776bca1dee330a76776f831e12ea8b36d.tar.bz2 |
Merged revisions 72690 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r72690 | benjamin.peterson | 2009-05-16 16:44:25 -0500 (Sat, 16 May 2009) | 1 line
properly lookup __instancecheck__ and __subclasscheck__
........
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 7e81ce6..0035f6d 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -599,14 +599,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)) { @@ -619,13 +611,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}, @@ -635,8 +620,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} }; @@ -2518,6 +2501,10 @@ static PyMethodDef type_methods[] = { METH_VARARGS | METH_KEYWORDS | METH_CLASS, PyDoc_STR("__prepare__() -> dict\n" "used to create the namespace for the class statement")}, + {"__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} }; |