summaryrefslogtreecommitdiffstats
path: root/Modules/_tkinter.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2003-05-03 09:45:12 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2003-05-03 09:45:12 (GMT)
commitdd6cd65b980c06e66b3d643f7b09ad5901851e05 (patch)
treeb5df45d3db081a774b12d4c62ab5fa84e5a64f3d /Modules/_tkinter.c
parentc16f3bd8a391a68427a95e15a3c1894198ff0377 (diff)
downloadcpython-dd6cd65b980c06e66b3d643f7b09ad5901851e05.zip
cpython-dd6cd65b980c06e66b3d643f7b09ad5901851e05.tar.gz
cpython-dd6cd65b980c06e66b3d643f7b09ad5901851e05.tar.bz2
Implement tcl object __cmp__.
Diffstat (limited to 'Modules/_tkinter.c')
-rw-r--r--Modules/_tkinter.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index e1238d6..a61bf7f 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -810,6 +810,17 @@ PyTclObject_repr(PyTclObject *self)
return PyString_FromString(buf);
}
+static int
+PyTclObject_cmp(PyTclObject *self, PyTclObject *other)
+{
+ int res;
+ res = strcmp(Tcl_GetString(self->value),
+ Tcl_GetString(other->value));
+ if (res < 0) return -1;
+ if (res > 0) return 1;
+ return 0;
+}
+
PyDoc_STRVAR(get_typename__doc__, "name of the Tcl type");
static PyObject*
@@ -843,7 +854,7 @@ statichere PyTypeObject PyTclObject_Type = {
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
- 0, /*tp_compare*/
+ (cmpfunc)PyTclObject_cmp, /*tp_compare*/
(reprfunc)PyTclObject_repr, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/