From d4b5c98fa66c8e80bcb719d0fa11222495b646ac Mon Sep 17 00:00:00 2001 From: Mark Dickinson Date: Sat, 2 May 2009 17:55:01 +0000 Subject: Remove unnecessary use of context for long getters. (Related to issue #5880). --- Objects/longobject.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/Objects/longobject.c b/Objects/longobject.c index 4b6502d..1fe7b06 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -3595,8 +3595,13 @@ long_getnewargs(PyLongObject *v) } static PyObject * -long_getN(PyLongObject *v, void *context) { - return PyLong_FromLong((Py_intptr_t)context); +long_get0(PyLongObject *v, void *context) { + return PyLong_FromLong(0L); +} + +static PyObject * +long_get1(PyLongObject *v, void *context) { + return PyLong_FromLong(1L); } static PyObject * @@ -3729,22 +3734,22 @@ static PyMethodDef long_methods[] = { }; static PyGetSetDef long_getset[] = { - {"real", + {"real", (getter)long_long, (setter)NULL, "the real part of a complex number", NULL}, - {"imag", - (getter)long_getN, (setter)NULL, + {"imag", + (getter)long_get0, (setter)NULL, "the imaginary part of a complex number", - (void*)0}, - {"numerator", + NULL}, + {"numerator", (getter)long_long, (setter)NULL, "the numerator of a rational number in lowest terms", NULL}, - {"denominator", - (getter)long_getN, (setter)NULL, + {"denominator", + (getter)long_get1, (setter)NULL, "the denominator of a rational number in lowest terms", - (void*)1}, + NULL}, {NULL} /* Sentinel */ }; -- cgit v0.12