]> granicus.if.org Git - python/commitdiff
Add check to conjugate() that there are no excess arguments.
authorGuido van Rossum <guido@python.org>
Thu, 7 May 1998 16:29:10 +0000 (16:29 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 7 May 1998 16:29:10 +0000 (16:29 +0000)
Objects/complexobject.c

index a186c8ec583a41b10765981348b44626cf881cdf..2e9771315614183605df854434fd99ea15c9c5f2 100644 (file)
@@ -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 */
 };