mirror of https://github.com/python/cpython
Make test_builtin work when executed directly
This commit is contained in:
parent
22ba31a3af
commit
2f9f056db1
|
@ -584,6 +584,9 @@ class BuiltinTest(unittest.TestCase):
|
||||||
raise frozendict_error("frozendict is readonly")
|
raise frozendict_error("frozendict is readonly")
|
||||||
|
|
||||||
# read-only builtins
|
# read-only builtins
|
||||||
|
if isinstance(__builtins__, types.ModuleType):
|
||||||
|
frozen_builtins = frozendict(__builtins__.__dict__)
|
||||||
|
else:
|
||||||
frozen_builtins = frozendict(__builtins__)
|
frozen_builtins = frozendict(__builtins__)
|
||||||
code = compile("__builtins__['superglobal']=2; print(superglobal)", "test", "exec")
|
code = compile("__builtins__['superglobal']=2; print(superglobal)", "test", "exec")
|
||||||
self.assertRaises(frozendict_error,
|
self.assertRaises(frozendict_error,
|
||||||
|
|
Loading…
Reference in New Issue