Commit 84c7d1da authored by Stefan Behnel's avatar Stefan Behnel

sort variable entries in closure scope to get a predictable C code result

parent 6c2a2b3b
...@@ -1228,17 +1228,18 @@ class CreateClosureClasses(CythonTransform): ...@@ -1228,17 +1228,18 @@ class CreateClosureClasses(CythonTransform):
cname=Naming.outer_scope_cname, cname=Naming.outer_scope_cname,
type=node.entry.scope.scope_class.type, type=node.entry.scope.scope_class.type,
is_cdef=True) is_cdef=True)
for entry in func_scope.entries.values(): entries = func_scope.entries.items()
entries.sort()
for name, entry in entries:
# This is wasteful--we should do this later when we know # This is wasteful--we should do this later when we know
# which vars are actually being used inside... # which vars are actually being used inside...
# #
# Also, this happens before type inference and type # Also, this happens before type inference and type
# analysis, so the entries created here may end up having # analysis, so the entries created here may end up having
# incorrect or at least unspecified types. # incorrect or at least unspecified types.
cname = entry.cname
class_scope.declare_var(pos=entry.pos, class_scope.declare_var(pos=entry.pos,
name=entry.name, name=entry.name,
cname=cname, cname=entry.cname,
type=entry.type, type=entry.type,
is_cdef=True) is_cdef=True)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment