Keep global statements in fixed order

This commit is contained in:
Yiming Wang
2018-02-24 22:22:50 +08:00
parent 8463221527
commit 3545c7dc6f
4 changed files with 10 additions and 10 deletions

View File

@@ -1768,8 +1768,8 @@ def deparse_code(version, co, out=StringIO(), showasm=False, showast=False,
deparsed.set_pos_info(deparsed.ast, 0, len(deparsed.text))
deparsed.fixup_parents(deparsed.ast, None)
for g in deparsed.mod_globs:
deparsed.write('# global %s ## Warning: Unused global' % g)
for g in sorted(deparsed.mod_globs):
deparsed.write('# global %s ## Warning: Unused global\n' % g)
if deparsed.ast_errors:
deparsed.write("# NOTE: have decompilation errors.\n")