From: Stefan Behnel Date: Fri, 23 Apr 2010 13:21:52 +0000 (+0200) Subject: sort variable entries in closure scope to get a predictable C code result X-Git-Tag: 0.13.beta0~2^2~90 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=84c7d1dae67b7fdc2887188943c7cf6e8db44125;p=cython.git sort variable entries in closure scope to get a predictable C code result --- diff --git a/Cython/Compiler/ParseTreeTransforms.py b/Cython/Compiler/ParseTreeTransforms.py index adf90ad7..20b38442 100644 --- a/Cython/Compiler/ParseTreeTransforms.py +++ b/Cython/Compiler/ParseTreeTransforms.py @@ -1228,17 +1228,18 @@ class CreateClosureClasses(CythonTransform): cname=Naming.outer_scope_cname, type=node.entry.scope.scope_class.type, 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 # which vars are actually being used inside... # # Also, this happens before type inference and type # analysis, so the entries created here may end up having # incorrect or at least unspecified types. - cname = entry.cname class_scope.declare_var(pos=entry.pos, name=entry.name, - cname=cname, + cname=entry.cname, type=entry.type, is_cdef=True)