]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
It's merge time!
authorMichael W. Hudson <mwh@python.net>
Mon, 28 Jan 2002 15:03:36 +0000 (15:03 +0000)
committerMichael W. Hudson <mwh@python.net>
Mon, 28 Jan 2002 15:03:36 +0000 (15:03 +0000)
Backport gvanrossum's checkin of revision 2.38:

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.

Modules/newmodule.c

index 252637ab524eacc95d603aff61034163327a4650..0a48926da65ef1809b3323ebfe5fcdaf77ca5cf2 100644 (file)
@@ -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);
 }