Author belopolsky
Recipients belopolsky, btomtom5
Date 2016-03-14.19:54:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1457985258.83.0.398369995487.issue26561@psf.upfronthosting.co.za>
In-reply-to
Content
The SO example works for me with Python 3.5.1:

Python 3.5.1 (default, Mar  8 2016, 12:33:47)
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> global_function = """
... x = "Hello World"
... def print_global_x():
...     print(x)
... print_global_x()
... """
>>> import builtins
>>> class TestEnvironment(dict):
...     def __init__(self, *args):
...         super().__init__(*args)
...
>>> global_env = TestEnvironment()
>>> global_env['__builtins__'] = builtins
>>> exec(global_function, global_env)
Hello World

btomtom5 - a bug report that consists only of an SO link is likely to be treated as spam by many issue tracker subscribers.  In the future, please try to make your reports self-contained.
History
Date User Action Args
2016-03-14 19:54:18belopolskysetrecipients: + belopolsky, btomtom5
2016-03-14 19:54:18belopolskysetmessageid: <1457985258.83.0.398369995487.issue26561@psf.upfronthosting.co.za>
2016-03-14 19:54:18belopolskylinkissue26561 messages
2016-03-14 19:54:18belopolskycreate