Mark Dickinson <[email protected]> added the comment: Ah, it looks like 'locals()' is somewhat magical. Its docstring says:
"Update and return a dictionary containing the current scope's local variables." So I think this explains your (Stefan's) results: in either case, you evaluate locals() (as the target of the for statement) and get a dictionary back. But that dictionary isn't updated to include 'name' and 'val' until you call locals() for a second time. (And possibly there are other activities besides an explicit locals() call that would cause that dict to be updated, but I'm not sure.) I still don't understand how things work when profile is added into the mix, but I'm willing to accept that the profile module affects locals() in strange and possibly timing-dependent ways. Anyway, the fix for decimal is clear: get rid of that locals call. ---------- stage: unit test needed -> needs patch _______________________________________ Python tracker <[email protected]> <http://bugs.python.org/issue9136> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
