[New-bugs-announce] [issue3723] Py_NewInterpreter does not work

Amaury Forgeot d'Arc report at bugs.python.org
Fri Aug 29 14:11:10 CEST 2008

New submission from Amaury Forgeot d'Arc <amauryfa at gmail.com>:

The example Demo/embed/importexc.c crashes, because Py_NewInterpreter
cannot reimport builtins and sys modules. This problem seems important
for embedding applications like mod_python, for example.

(the "import exceptions" statement does not work with python 3.0, but
replacing with e.g. "import types" does not change anything: the
interpreter is not correctly renewed)

I tried to put "-1" in the m_size structure of these modules, and they
seem to import correctly. However, "builtins" comes with its original
dictionary - without the standard exceptions.

I think that these modules should be made re-importable, with specific

Maybe two related problems:
- once you've done
    del sys.modules['sys']
it's not possible to get it back, "import sys" raises an error...

- the usual trick to call sys.setdefaultencoding will not work, since it
needs to "imp.reload(sys)"

components: Extension Modules
messages: 72127
nosy: amaury.forgeotdarc, loewis
priority: release blocker
severity: normal
status: open
title: Py_NewInterpreter does not work
versions: Python 3.0

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list