Skip to content

Commit c3b8bb6

Browse files
committed
Fix printing namespaces with hoisted literals
These bindings do not have a name to sort by, so use their value instead.
1 parent de2b9b5 commit c3b8bb6

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

test/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def namespace_name(node):
4343
for name in sorted(namespace.nonlocal_names):
4444
s += indent + ' - nonlocal ' + name + '\n'
4545

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

4949
for child in iter_child_namespaces(namespace):

0 commit comments

Comments
 (0)