[pypy-dev] Modifying sys.modules while importing

Seo Sanghyeon tinuviel at fluid.sparcs.net
Mon Jul 5 13:59:46 CEST 2004


Consider following setup:

mkdir a
mkdir b
cat >a/__init__.py <<END
import sys, b
sys.modules[__name__] = b
END
touch b/__init__.py
touch b/c.py

Now run "import a.c".

CPython imports okay, PyPy raises ImportError. This breaks xml package
when PyXML is installed. Read Lib/xml/__init__.py for details.

Bye,



More information about the Pypy-dev mailing list