This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author r.david.murray
Recipients benjamin.peterson, r.david.murray, techtonik
Date 2012-12-26.20:55:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1356555309.74.0.920714552003.issue16781@psf.upfronthosting.co.za>
In-reply-to
Content
Do you mean that *modifying* locals() in the function scope is undefined behavior?  That makes sense, and is a documented limitation.

So we need to clarify the execfile/exec documentation to note that if called in anything other than the global scope, locals() will get used as the locals dictionary, and this will lead to undefined behavior if any operation is performed that updates the local namespace...and thus you are best recommend to always pass one or two dictionaries to execfile/exec, so that you *know* what is getting updated.

Although I have to say that the exec/execfile doing something that is specified to lead to undefined behavior smells like a bug.  (Not that we could fix it even if we agreed that it was, for backward compatibility reasons.)
History
Date User Action Args
2012-12-26 20:55:09r.david.murraysetrecipients: + r.david.murray, techtonik, benjamin.peterson
2012-12-26 20:55:09r.david.murraysetmessageid: <1356555309.74.0.920714552003.issue16781@psf.upfronthosting.co.za>
2012-12-26 20:55:09r.david.murraylinkissue16781 messages
2012-12-26 20:55:09r.david.murraycreate