From 7ef8b7dd49d103a6545d70a39398a56c2dbe138b Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 18 Feb 2011 07:37:25 -0800 Subject: egencache: fix cmp_func for python3 --- bin/egencache | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'bin') diff --git a/bin/egencache b/bin/egencache index e5685c4dc..5307cd5a2 100755 --- a/bin/egencache +++ b/bin/egencache @@ -455,6 +455,14 @@ class GenUseLocalDesc(object): # since we don't want any confusion given that we never # want to rely on the builtin cmp function. def cmp_func(a, b): + if a is None or b is None: + # None can't be compared with other types in python3. + if a is None and b is None: + return 0 + elif a is None: + return -1 + else: + return 1 return (a > b) - (a < b) for cp in self._portdb.cp_all(): -- cgit v1.2.3-1-g7c22