Commit 8530ef62 authored by Guido van Rossum's avatar Guido van Rossum

Add check to conjugate() that there are no excess arguments.

parent dda6696b
...@@ -573,17 +573,20 @@ complex_float(v) ...@@ -573,17 +573,20 @@ complex_float(v)
} }
static PyObject * static PyObject *
complex_conjugate(self) complex_conjugate(self, args)
PyObject *self; PyObject *self;
PyObject *args;
{ {
Py_complex c; Py_complex c;
if (!PyArg_ParseTuple(args, ""))
return NULL;
c = ((PyComplexObject *)self)->cval; c = ((PyComplexObject *)self)->cval;
c.imag = -c.imag; c.imag = -c.imag;
return PyComplex_FromCComplex(c); return PyComplex_FromCComplex(c);
} }
static PyMethodDef complex_methods[] = { static PyMethodDef complex_methods[] = {
{"conjugate", (PyCFunction)complex_conjugate, 1}, {"conjugate", complex_conjugate, 1},
{NULL, NULL} /* sentinel */ {NULL, NULL} /* sentinel */
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment