diff options
author | Brett Cannon <brett@python.org> | 2013-06-16 03:24:11 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2013-06-16 03:24:11 (GMT) |
commit | 2f9f056db132a66dcc9de452bf1e90969ae7c74d (patch) | |
tree | 86e17220384c929020caf9870be6b16e5a7045ac /Lib/test/test_builtin.py | |
parent | 22ba31a3afe39aed3ad4942008b5b9ce7261c293 (diff) | |
download | cpython-2f9f056db132a66dcc9de452bf1e90969ae7c74d.zip cpython-2f9f056db132a66dcc9de452bf1e90969ae7c74d.tar.gz cpython-2f9f056db132a66dcc9de452bf1e90969ae7c74d.tar.bz2 |
Make test_builtin work when executed directly
Diffstat (limited to 'Lib/test/test_builtin.py')
-rw-r--r-- | Lib/test/test_builtin.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py index f46f8d5..f850456 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -584,7 +584,10 @@ class BuiltinTest(unittest.TestCase): raise frozendict_error("frozendict is readonly") # read-only builtins - frozen_builtins = frozendict(__builtins__) + if isinstance(__builtins__, types.ModuleType): + frozen_builtins = frozendict(__builtins__.__dict__) + else: + frozen_builtins = frozendict(__builtins__) code = compile("__builtins__['superglobal']=2; print(superglobal)", "test", "exec") self.assertRaises(frozendict_error, exec, code, {'__builtins__': frozen_builtins}) |