mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
There's no need for typechecks on the second and third argument of
new.instancemethod() -- the instancemethod object is now a perfectly general container. This fixes SF bug ##503091 (Pedro Rodriquez): new.instancemethod fails for new classes This is a 2.2.1 candidate.
This commit is contained in:
parent
5e99731ab9
commit
4f3a62d9bc
2 changed files with 3 additions and 11 deletions
|
@ -40,10 +40,8 @@ new_instancemethod(PyObject* unused, PyObject* args)
|
|||
PyObject* self;
|
||||
PyObject* classObj;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "OOO!:instancemethod",
|
||||
&func,
|
||||
&self,
|
||||
&PyClass_Type, &classObj))
|
||||
if (!PyArg_ParseTuple(args, "OOO:instancemethod",
|
||||
&func, &self, &classObj))
|
||||
return NULL;
|
||||
if (!PyCallable_Check(func)) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
|
@ -52,11 +50,6 @@ new_instancemethod(PyObject* unused, PyObject* args)
|
|||
}
|
||||
if (self == Py_None)
|
||||
self = NULL;
|
||||
else if (!PyInstance_Check(self)) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"second argument must be instance or None");
|
||||
return NULL;
|
||||
}
|
||||
return PyMethod_New(func, self, classObj);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue