[Patches] [ python-Patches-422106 ] Seg fault in sys.displayhook
noreply@sourceforge.net
noreply@sourceforge.net
Mon, 07 May 2001 13:10:12 -0700
Patches item #422106, was updated on 2001-05-07 13:07
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=422106&group_id=5470
Category: core (C code)
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Gregory H. Ball (greg_ball)
Assigned to: Nobody/Anonymous (nobody)
Summary: Seg fault in sys.displayhook
Initial Comment:
If you do a very silly thing and delete the
"__builtin__" entry
from sys.modules, the default displayhook is defeated.
This problem exists in 2.1 and current CVS, but not 2.0
(The old display loop held a reference to the builtin
module instead of repeatedly fetching it in 2.0, I
guess.)
My patch just checks whether the module is in the
expected location and raises an exception instead of
dumping core.
The error message is not especially illuminating, but
then,
anyone who actually does this deserves far worse ;-)
----------------------------------------------------------------------
>Comment By: Gregory H. Ball (greg_ball)
Date: 2001-05-07 13:10
Message:
Logged In: YES
user_id=11365
The problem:
Python 2.2a0 (#13, May 7 2001, 15:45:00)
[GCC 2.95.3 19991030 (prerelease)] on linux2
Type "copyright", "credits" or "license" for more
information.
>>> import sys
>>> del sys.modules['__builtin__']
>>> 1
Segmentation fault (core dumped)
The solution:
Python 2.2a0 (#16, May 7 2001, 16:03:33)
[GCC 2.95.3 19991030 (prerelease)] on linux2
Type "copyright", "credits" or "license" for more
information.
>>> import sys
>>> del sys.modules['__builtin__']
>>> 1
Traceback (most recent call last):
File "<stdin>", line 1, in ?
RuntimeError: lost __builtin__
>>>
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=422106&group_id=5470