diff options
author | Simon Marchi <simon.marchi@ericsson.com> | 2018-06-27 14:32:05 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2018-06-27 14:32:05 -0400 |
commit | 68ad5fb9aa5ea8d00f95a19cd0c3ab211fb21f83 (patch) | |
tree | bae362a8ffa134e8c69bf42a5e382bc440b7d789 /gdb | |
parent | 141ec9f67f11a34bae5953b2923bb71fc74dd52f (diff) | |
download | gdb-68ad5fb9aa5ea8d00f95a19cd0c3ab211fb21f83.zip gdb-68ad5fb9aa5ea8d00f95a19cd0c3ab211fb21f83.tar.gz gdb-68ad5fb9aa5ea8d00f95a19cd0c3ab211fb21f83.tar.bz2 |
gdb-gdb.py.in: Fix ordering of TypeFlags objects with Python 3
Python 3 doesn't use __cmp__ to order objects, it uses __lt__. Because
of this, we get this exception when trying to pretty-print "type"
objects:
I tested it with Python 2.7 as well.
gdb/ChangeLog:
* gdb-gdb.py.in (TypeFlag) <__cmp__>: Remove.
<__lt__>: Add.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/gdb-gdb.py.in | 6 |
2 files changed, 9 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 644aed8..9a74009 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2018-06-27 Simon Marchi <simon.marchi@ericsson.com> + * gdb-gdb.py.in (TypeFlag) <__cmp__>: Remove. + <__lt__>: Add. + +2018-06-27 Simon Marchi <simon.marchi@ericsson.com> + * gdb-gdb.py: Move to... * gdb-gdb.py.in: ... here. * configure.ac (AC_CONFIG_FILES): Add gdb-gdb.py. diff --git a/gdb/gdb-gdb.py.in b/gdb/gdb-gdb.py.in index b8bb1ad..c844e4c 100644 --- a/gdb/gdb-gdb.py.in +++ b/gdb/gdb-gdb.py.in @@ -38,9 +38,11 @@ class TypeFlag: self.name = name self.value = value self.short_name = name.replace("TYPE_INSTANCE_FLAG_", '') - def __cmp__(self, other): + + def __lt__(self, other): """Sort by value order.""" - return self.value.__cmp__(other.value) + return self.value < other.value + # A list of all existing TYPE_INSTANCE_FLAGS_* enumerations, # stored as TypeFlags objects. Lazy-initialized. |