mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
raise an ImportError (rather than fatal) when __import__ is not found in __builtins__ (closes #17867)
This commit is contained in:
parent
775ccdf1fc
commit
7d110042c5
3 changed files with 11 additions and 1 deletions
|
|
@ -324,6 +324,13 @@ class ImportTests(unittest.TestCase):
|
|||
except ImportError:
|
||||
self.fail("fromlist must allow bogus names")
|
||||
|
||||
@cpython_only
|
||||
def test_delete_builtins_import(self):
|
||||
args = ["-c", "del __builtins__.__import__; import os"]
|
||||
popen = script_helper.spawn_python(*args)
|
||||
stdout, stderr = popen.communicate()
|
||||
self.assertIn(b"ImportError", stdout)
|
||||
|
||||
|
||||
@skip_if_dont_write_bytecode
|
||||
class FilePermissionTests(unittest.TestCase):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue