#3247: get rid of Py_FindMethod

Third step: unix-only modules. Really remove the function this time.
This commit is contained in:
Amaury Forgeot d'Arc 2008-07-02 22:38:47 +00:00
parent 7c265a1943
commit 1f900f1f69
8 changed files with 105 additions and 96 deletions

View file

@ -280,43 +280,6 @@ PyTypeObject PyCFunction_Type = {
0, /* tp_dict */
};
/* Find a method in a method chain */
PyObject *
Py_FindMethodInChain(PyMethodChain *chain, PyObject *self, const char *name)
{
if (name[0] == '_' && name[1] == '_') {
if (strcmp(name, "__doc__") == 0) {
const char *doc = self->ob_type->tp_doc;
if (doc != NULL)
return PyUnicode_FromString(doc);
}
}
while (chain != NULL) {
PyMethodDef *ml = chain->methods;
for (; ml->ml_name != NULL; ml++) {
if (name[0] == ml->ml_name[0] &&
strcmp(name+1, ml->ml_name+1) == 0)
/* XXX */
return PyCFunction_New(ml, self);
}
chain = chain->link;
}
PyErr_SetString(PyExc_AttributeError, name);
return NULL;
}
/* Find a method in a single method list */
PyObject *
Py_FindMethod(PyMethodDef *methods, PyObject *self, const char *name)
{
PyMethodChain chain;
chain.methods = methods;
chain.link = NULL;
return Py_FindMethodInChain(&chain, self, name);
}
/* Clear out the free list */
int