diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2009-05-03 20:39:06 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2009-05-03 20:39:06 (GMT) |
commit | 85e269b37d6b6599fd143c72395f5e6d58f15088 (patch) | |
tree | 15def4408f0bac2504eb5fae5b23bfde465de07f /Objects | |
parent | 4bd76641b845022c6a8ae5c68a1bd15145b02935 (diff) | |
download | cpython-85e269b37d6b6599fd143c72395f5e6d58f15088.zip cpython-85e269b37d6b6599fd143c72395f5e6d58f15088.tar.gz cpython-85e269b37d6b6599fd143c72395f5e6d58f15088.tar.bz2 |
Remove unnecessary uses of context in PyGetSetDef. See issue #5880.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/intobject.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/Objects/intobject.c b/Objects/intobject.c index 1b64fe7..a0e60e7 100644 --- a/Objects/intobject.c +++ b/Objects/intobject.c @@ -1104,8 +1104,13 @@ int_getnewargs(PyIntObject *v) } static PyObject * -int_getN(PyIntObject *v, void *context) { - return PyInt_FromLong((Py_intptr_t)context); +int_get0(PyIntObject *v, void *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. @@ -1254,22 +1259,22 @@ static PyMethodDef int_methods[] = { }; static PyGetSetDef int_getset[] = { - {"real", + {"real", (getter)int_int, (setter)NULL, "the real part of a complex number", NULL}, - {"imag", - (getter)int_getN, (setter)NULL, + {"imag", + (getter)int_get0, (setter)NULL, "the imaginary part of a complex number", - (void*)0}, - {"numerator", + NULL}, + {"numerator", (getter)int_int, (setter)NULL, "the numerator of a rational number in lowest terms", NULL}, - {"denominator", - (getter)int_getN, (setter)NULL, + {"denominator", + (getter)int_get1, (setter)NULL, "the denominator of a rational number in lowest terms", - (void*)1}, + NULL}, {NULL} /* Sentinel */ }; |