Since Python 2.4 .sort() as well as the new sorted() function take a key parameter which should be a function that returns a sorting key. Signed-off-by: Robert Kuska <rkuska@xxxxxxxxxx> --- sepolgen/src/sepolgen/lex.py | 4 ++-- sepolgen/src/sepolgen/yacc.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sepolgen/src/sepolgen/lex.py b/sepolgen/src/sepolgen/lex.py index 7f12e26..3f5904b 100644 --- a/sepolgen/src/sepolgen/lex.py +++ b/sepolgen/src/sepolgen/lex.py @@ -635,11 +635,11 @@ def lex(module=None,object=None,debug=0,optimize=0,lextab="lextab",reflags=0,now # Sort the functions by line number for f in funcsym.values(): - f.sort(lambda x,y: cmp(x[1].__code__.co_firstlineno,y[1].__code__.co_firstlineno)) + f.sort(key=lambda x: x[1].__code__.co_firstlineno) # Sort the strings by regular expression length for s in strsym.values(): - s.sort(lambda x,y: (len(x[1]) < len(y[1])) - (len(x[1]) > len(y[1]))) + s.sort(key=lambda x: len(x[1])) regexs = { } diff --git a/sepolgen/src/sepolgen/yacc.py b/sepolgen/src/sepolgen/yacc.py index d821940..cd113fc 100644 --- a/sepolgen/src/sepolgen/yacc.py +++ b/sepolgen/src/sepolgen/yacc.py @@ -2100,7 +2100,7 @@ def yacc(method=default_lr, debug=yaccdebug, module=None, tabmodule=tab_module, raise YaccError,"no rules of the form p_rulename are defined." # Sort the symbols by line number - symbols.sort(lambda x,y: cmp(x.__code__.co_firstlineno,y.__code__.co_firstlineno)) + symbols.sort(key=lambda x: x.__code__.co_firstlineno) # Add all of the symbols to the grammar for f in symbols: -- 2.4.3 _______________________________________________ Selinux mailing list Selinux@xxxxxxxxxxxxx To unsubscribe, send email to Selinux-leave@xxxxxxxxxxxxx. To get help, send an email containing "help" to Selinux-request@xxxxxxxxxxxxx.