[Python-checkins] r72202 - python/trunk/Objects/longobject.c

mark.dickinson python-checkins at python.org
Sat May 2 19:55:01 CEST 2009


Author: mark.dickinson
Date: Sat May  2 19:55:01 2009
New Revision: 72202

Log:
Remove unnecessary use of context for long getters.
(Related to issue #5880).


Modified:
   python/trunk/Objects/longobject.c

Modified: python/trunk/Objects/longobject.c
==============================================================================
--- python/trunk/Objects/longobject.c	(original)
+++ python/trunk/Objects/longobject.c	Sat May  2 19:55:01 2009
@@ -3595,8 +3595,13 @@
 }
 
 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 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 */
 };
 


More information about the Python-checkins mailing list