[New-bugs-announce] [issue17867] Deleting __import__ from builtins can crash Python3

Dmi Baranov report at bugs.python.org
Mon Apr 29 12:15:23 CEST 2013


New submission from Dmi Baranov:

Simple case - let's delete __import__ and try to import anything

$ python3.3
Python 3.3.0 (default, Oct  7 2012, 11:03:52) 
[GCC 4.4.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> del __builtins__.__dict__['__import__']
>>> import os
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
Fatal Python error: __import__ missing

Current thread 0x00007f07c9ebc700:
Aborted

But in python2.x

$ python2.7
Python 2.7.3 (default, Sep 22 2012, 02:37:18) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> del __builtins__.__dict__['__import__']
>>> import os
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: __import__ not found
>>>

----------
components: Interpreter Core
messages: 188059
nosy: Dmi.Baranov
priority: normal
severity: normal
status: open
title: Deleting __import__ from builtins can crash Python3
type: crash
versions: Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17867>
_______________________________________


More information about the New-bugs-announce mailing list