diff options
author | David Beazley <dave@dabeaz.com> | 2015-08-25 14:42:31 -0500 |
---|---|---|
committer | David Beazley <dave@dabeaz.com> | 2015-08-25 14:42:31 -0500 |
commit | 50e6b9df7b5e1680136fc795ad15d08f80e534b6 (patch) | |
tree | bc63565f23bb376a16ed15de3aec2650f0f47771 /ply | |
parent | a843b294852a1283ec6184e392a614eecf0cefa7 (diff) | |
parent | 8692bdcc20e941ad4fa5f6ac2f91c3f74cabc634 (diff) | |
download | ply-50e6b9df7b5e1680136fc795ad15d08f80e534b6.tar.gz |
Merge pull request #71 from moses-palmer/fixup-module-sort-order
Corrected ParserReflect.get_pfunctions on Python 3
Diffstat (limited to 'ply')
-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 429ad85..33064d4 100644 --- a/ply/yacc.py +++ b/ply/yacc.py @@ -3111,8 +3111,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 |