Skip to content

Commit

Permalink
Fix printing namespaces with hoisted literals
Browse files Browse the repository at this point in the history
These bindings do not have a name to sort by, so use their value instead.
  • Loading branch information
dflook committed Nov 11, 2024
1 parent de2b9b5 commit c3b8bb6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def namespace_name(node):
for name in sorted(namespace.nonlocal_names):
s += indent + ' - nonlocal ' + name + '\n'

for binding in sorted(namespace.bindings, key=lambda b: b.name):
for binding in sorted(namespace.bindings, key=lambda b: b.name or str(b.value)):
s += indent + ' - ' + repr(binding) + '\n'

for child in iter_child_namespaces(namespace):
Expand Down

0 comments on commit c3b8bb6

Please sign in to comment.