From 8530ef625aabda9d11ffcee8c4c6fd7230c05185 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Thu, 7 May 1998 16:29:10 +0000 Subject: Add check to conjugate() that there are no excess arguments. --- Objects/complexobject.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Objects/complexobject.c b/Objects/complexobject.c index a186c8e..2e97713 100644 --- a/Objects/complexobject.c +++ b/Objects/complexobject.c @@ -573,17 +573,20 @@ complex_float(v) } static PyObject * -complex_conjugate(self) +complex_conjugate(self, args) PyObject *self; + PyObject *args; { Py_complex c; + if (!PyArg_ParseTuple(args, "")) + return NULL; c = ((PyComplexObject *)self)->cval; c.imag = -c.imag; return PyComplex_FromCComplex(c); } static PyMethodDef complex_methods[] = { - {"conjugate", (PyCFunction)complex_conjugate, 1}, + {"conjugate", complex_conjugate, 1}, {NULL, NULL} /* sentinel */ }; -- cgit v0.12