summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/PythonUtil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Slice/PythonUtil.cpp')
-rw-r--r--cpp/src/Slice/PythonUtil.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/cpp/src/Slice/PythonUtil.cpp b/cpp/src/Slice/PythonUtil.cpp
index fdc6449285d..1e730598a94 100644
--- a/cpp/src/Slice/PythonUtil.cpp
+++ b/cpp/src/Slice/PythonUtil.cpp
@@ -1103,16 +1103,24 @@ Slice::Python::CodeVisitor::visitStructStart(const StructPtr& p)
_out << nl << "return _h % 0x7fffffff";
_out.dec();
- _out << sp << nl << "def __eq__(self, other):";
+ _out << sp << nl << "def __cmp__(self, other):";
+ _out.inc();
+ _out << nl << "if other == None:";
_out.inc();
+ _out << nl << "return 1";
+ _out.dec();
for(r = memberList.begin(); r != memberList.end(); ++r)
{
- _out << nl << "if not self." << r->fixedName << " == other." << r->fixedName << ':';
+ _out << nl << "if self." << r->fixedName << " < other." << r->fixedName << ':';
+ _out.inc();
+ _out << nl << "return -1";
+ _out.dec();
+ _out << nl << "elif self." << r->fixedName << " > other." << r->fixedName << ':';
_out.inc();
- _out << nl << "return False";
+ _out << nl << "return 1";
_out.dec();
}
- _out << nl << "return True";
+ _out << nl << "return 0";
_out.dec();
//