diff options
Diffstat (limited to 'ply/yacc.py')
-rw-r--r-- | ply/yacc.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/ply/yacc.py b/ply/yacc.py index eb02cc2..127b12e 100644 --- a/ply/yacc.py +++ b/ply/yacc.py @@ -3108,8 +3108,14 @@ class ParserReflect(object): module = inspect.getmodule(item) p_functions.append((line, module, name, item.__doc__)) - # Sort all of the actions by line number - p_functions.sort() + # Sort all of the actions by line number; make sure to stringify + # modules to make them sortable, since `line` may not uniquely sort all + # p functions + p_functions.sort(key=lambda p_function: ( + p_function[0], + str(p_function[1]), + p_function[2], + p_function[3])) self.pfuncs = p_functions # Validate all of the p_functions |