summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2004-09-23 02:39:37 (GMT)
committerTim Peters <tim.peters@gmail.com>2004-09-23 02:39:37 (GMT)
commitf4aca755bc9f26b51b6820a162a3f76c2a1a1abc (patch)
tree396d803b3cf3ffbee73269c6ebb92e25f30ee373 /Objects
parent7790c3b802e98f706f0caf729cdd8a5bad5a3ce7 (diff)
downloadcpython-f4aca755bc9f26b51b6820a162a3f76c2a1a1abc.zip
cpython-f4aca755bc9f26b51b6820a162a3f76c2a1a1abc.tar.gz
cpython-f4aca755bc9f26b51b6820a162a3f76c2a1a1abc.tar.bz2
A static swapped_op[] array was defined in 3 different C files, & I think
I need to define it again. Bite the bullet and define it once as an extern, _Py_SwappedOp[].
Diffstat (limited to 'Objects')
-rw-r--r--Objects/classobject.c5
-rw-r--r--Objects/object.c8
-rw-r--r--Objects/typeobject.c5
3 files changed, 6 insertions, 12 deletions
diff --git a/Objects/classobject.c b/Objects/classobject.c
index bdbcd6a..506faab 100644
--- a/Objects/classobject.c
+++ b/Objects/classobject.c
@@ -1873,9 +1873,6 @@ half_richcompare(PyObject *v, PyObject *w, int op)
return res;
}
-/* Map rich comparison operators to their swapped version, e.g. LT --> GT */
-static int swapped_op[] = {Py_GT, Py_GE, Py_EQ, Py_NE, Py_LT, Py_LE};
-
static PyObject *
instance_richcompare(PyObject *v, PyObject *w, int op)
{
@@ -1889,7 +1886,7 @@ instance_richcompare(PyObject *v, PyObject *w, int op)
}
if (PyInstance_Check(w)) {
- res = half_richcompare(w, v, swapped_op[op]);
+ res = half_richcompare(w, v, _Py_SwappedOp[op]);
if (res != Py_NotImplemented)
return res;
Py_DECREF(res);
diff --git a/Objects/object.c b/Objects/object.c
index 721a6ac..b28420d 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -476,7 +476,7 @@ adjust_tp_compare(int c)
? (t)->tp_richcompare : NULL)
/* Map rich comparison operators to their swapped version, e.g. LT --> GT */
-static int swapped_op[] = {Py_GT, Py_GE, Py_EQ, Py_NE, Py_LT, Py_LE};
+extern int _Py_SwappedOp[] = {Py_GT, Py_GE, Py_EQ, Py_NE, Py_LT, Py_LE};
/* Try a genuine rich comparison, returning an object. Return:
NULL for exception;
@@ -494,7 +494,7 @@ try_rich_compare(PyObject *v, PyObject *w, int op)
if (v->ob_type != w->ob_type &&
PyType_IsSubtype(w->ob_type, v->ob_type) &&
(f = RICHCOMPARE(w->ob_type)) != NULL) {
- res = (*f)(w, v, swapped_op[op]);
+ res = (*f)(w, v, _Py_SwappedOp[op]);
if (res != Py_NotImplemented)
return res;
Py_DECREF(res);
@@ -506,7 +506,7 @@ try_rich_compare(PyObject *v, PyObject *w, int op)
Py_DECREF(res);
}
if ((f = RICHCOMPARE(w->ob_type)) != NULL) {
- return (*f)(w, v, swapped_op[op]);
+ return (*f)(w, v, _Py_SwappedOp[op]);
}
res = Py_NotImplemented;
Py_INCREF(res);
@@ -1703,7 +1703,7 @@ PyObject_Dir(PyObject *arg)
assert(result);
if (!PyList_Check(result)) {
- PyErr_SetString(PyExc_TypeError,
+ PyErr_SetString(PyExc_TypeError,
"Expected keys() to be a list.");
goto error;
}
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 6f5323e..600dca5 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -4638,9 +4638,6 @@ half_richcompare(PyObject *self, PyObject *other, int op)
return res;
}
-/* Map rich comparison operators to their swapped version, e.g. LT --> GT */
-static int swapped_op[] = {Py_GT, Py_GE, Py_EQ, Py_NE, Py_LT, Py_LE};
-
static PyObject *
slot_tp_richcompare(PyObject *self, PyObject *other, int op)
{
@@ -4653,7 +4650,7 @@ slot_tp_richcompare(PyObject *self, PyObject *other, int op)
Py_DECREF(res);
}
if (other->ob_type->tp_richcompare == slot_tp_richcompare) {
- res = half_richcompare(other, self, swapped_op[op]);
+ res = half_richcompare(other, self, _Py_SwappedOp[op]);
if (res != Py_NotImplemented) {
return res;
}