Mercurial > cpython-lru_cache-weakref
diff Modules/newmodule.c @ 21723:ebe6bd576f65 legacy-trunk
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.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Tue, 15 Jan 2002 19:21:05 +0000 |
| parents | 3e9d6e9fbe58 |
| children | ed1ba37a46b7 856c81f71213 |
line wrap: on
line diff
--- a/Modules/newmodule.c Tue Jan 15 03:46:43 2002 +0000 +++ b/Modules/newmodule.c Tue Jan 15 19:21:05 2002 +0000 @@ -40,10 +40,8 @@ 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 @@ } 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); }
