New submission from Erik Sandberg <[EMAIL PROTECTED]>: When an exec statement called from a function f defines a top-level function g, the body of g cannot access the top-level symbols defined by the exec statement (which also happen to be the local variables of f). Example:
x = 2 def f(): exec "x = 1\ndef b(): return x" print b() f() An unqualified guess is that the mix of being top-level and being a local variable, makes the symbol end up somewhere between locals() and globals(). Example: The problem causes real-life problems when I want to create a wrapper function around execfile() to handle certain exceptions. ---------- components: Interpreter Core messages: 73795 nosy: sandberg severity: normal status: open title: Problems when calling exec from a function type: behavior versions: Python 2.4, Python 2.5 _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3963> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com