New submission from Ralf Schmitt <[EMAIL PROTECTED]>:

The following short program work in python 2.5, but does die with a
SystemError in python2.6:

~/ cat t.py 
#! /usr/bin/env python

res = dict(__package__='foo')
exec "from os import path" in res
~/ python2.5 t.py 
~/ python2.6 t.py 
Traceback (most recent call last):
  File "t.py", line 4, in <module>
exec "from os import path" in res
  File "<string>", line 1, in <module>
SystemError: Parent module 'foo' not loaded



I think this has been introduced with svn revision 42649
(http://hgpy.de/py/trunk/rev/54c72e1678d68ebbf274)

Part of the diff reads:
        modules = PyImport_GetModuleDict();
        parent = PyDict_GetItemString(modules, buf);
        if (parent == NULL)
-               parent = Py_None;
+               PyErr_Format(PyExc_SystemError,
+                               "Parent module '%.200s' not loaded", buf);
        return parent;
        /* We expect, but can't guarantee, if parent != None, that:

----------
messages: 68850
nosy: schmir
severity: normal
status: open
title: SystemError: Parent module 'foo' not loaded on import statement
type: behavior
versions: Python 2.6

_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3221>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to