summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-01-15 19:21:05 +0000
committerGuido van Rossum <guido@python.org>2002-01-15 19:21:05 +0000
commit7c84f749faf77e599afe5c19d3e896f9326d464c (patch)
tree8a18f6db45b78c5115418f2a580d93e4b9ac0351
parentb5ae7e8f508a3d20cdefc14da4cb5f4d88fc2ab5 (diff)
downloadcpython-7c84f749faf77e599afe5c19d3e896f9326d464c.tar.gz
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.
-rw-r--r--Doc/lib/libnew.tex3
-rw-r--r--Modules/newmodule.c11
2 files changed, 3 insertions, 11 deletions
diff --git a/Doc/lib/libnew.tex b/Doc/lib/libnew.tex
index 9547b588a6..67bfb2ed79 100644
--- a/Doc/lib/libnew.tex
+++ b/Doc/lib/libnew.tex
@@ -25,8 +25,7 @@ the object will be in a consistent state.
\begin{funcdesc}{instancemethod}{function, instance, class}
This function will return a method object, bound to \var{instance}, or
unbound if \var{instance} is \code{None}. \var{function} must be
-callable, and \var{instance} must be an instance object or
-\code{None}.
+callable.
\end{funcdesc}
\begin{funcdesc}{function}{code, globals\optional{, name\optional{, argdefs}}}
diff --git a/Modules/newmodule.c b/Modules/newmodule.c
index 252637ab52..0a48926da6 100644
--- a/Modules/newmodule.c
+++ b/Modules/newmodule.c
@@ -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);
}