mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Patch #427190: Implement and use METH_NOARGS and METH_O.
This commit is contained in:
parent
c35422109b
commit
e3eb1f2b23
17 changed files with 429 additions and 551 deletions
|
@ -580,18 +580,16 @@ complex_float(PyObject *v)
|
|||
}
|
||||
|
||||
static PyObject *
|
||||
complex_conjugate(PyObject *self, PyObject *args)
|
||||
complex_conjugate(PyObject *self)
|
||||
{
|
||||
Py_complex c;
|
||||
if (!PyArg_ParseTuple(args, ":conjugate"))
|
||||
return NULL;
|
||||
c = ((PyComplexObject *)self)->cval;
|
||||
c.imag = -c.imag;
|
||||
return PyComplex_FromCComplex(c);
|
||||
}
|
||||
|
||||
static PyMethodDef complex_methods[] = {
|
||||
{"conjugate", complex_conjugate, 1},
|
||||
{"conjugate", (PyCFunction)complex_conjugate, METH_NOARGS},
|
||||
{NULL, NULL} /* sentinel */
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue