Remove unnecessary uses of context in PyGetSetDef. See issue #5880.

This commit is contained in:
Mark Dickinson 2009-05-03 20:39:06 +00:00
parent 4bd76641b8
commit 85e269b37d
1 changed files with 15 additions and 10 deletions

View File

@ -1104,8 +1104,13 @@ int_getnewargs(PyIntObject *v)
} }
static PyObject * static PyObject *
int_getN(PyIntObject *v, void *context) { int_get0(PyIntObject *v, void *context) {
return PyInt_FromLong((Py_intptr_t)context); return PyInt_FromLong(0L);
}
static PyObject *
int_get1(PyIntObject *v, void *context) {
return PyInt_FromLong(1L);
} }
/* Convert an integer to the given base. Returns a string. /* Convert an integer to the given base. Returns a string.
@ -1254,22 +1259,22 @@ static PyMethodDef int_methods[] = {
}; };
static PyGetSetDef int_getset[] = { static PyGetSetDef int_getset[] = {
{"real", {"real",
(getter)int_int, (setter)NULL, (getter)int_int, (setter)NULL,
"the real part of a complex number", "the real part of a complex number",
NULL}, NULL},
{"imag", {"imag",
(getter)int_getN, (setter)NULL, (getter)int_get0, (setter)NULL,
"the imaginary part of a complex number", "the imaginary part of a complex number",
(void*)0}, NULL},
{"numerator", {"numerator",
(getter)int_int, (setter)NULL, (getter)int_int, (setter)NULL,
"the numerator of a rational number in lowest terms", "the numerator of a rational number in lowest terms",
NULL}, NULL},
{"denominator", {"denominator",
(getter)int_getN, (setter)NULL, (getter)int_get1, (setter)NULL,
"the denominator of a rational number in lowest terms", "the denominator of a rational number in lowest terms",
(void*)1}, NULL},
{NULL} /* Sentinel */ {NULL} /* Sentinel */
}; };