[Python-bugs-list] [Bug #121706] exceptions module cannot be imported in two interpreters

noreply@sourceforge.net noreply@sourceforge.net
Sun, 5 Nov 2000 15:40:55 -0800


Bug #121706, was updated on 2000-Nov-05 15:40
Here is a current snapshot of the bug.

Project: Python
Category: Modules
Status: Open
Resolution: None
Bug Group: None
Priority: 5
Summary: exceptions module cannot be imported in two interpreters

Details: If the exceptions module is imported in two separate interpreters within one process, the second import fails.  The program below fails when linked with Python 2.0 on RedHat Linux 6.2 with the following message:

Traceback (most recent call last):
  File "<string>", line 1, in ?
ImportError: Cannot re-init internal module exceptions

Program source:

#include <Python.h>

char *cmd = "import exceptions";

int main()
{
  Py_Initialize();
  PyEval_InitThreads();
  PyRun_SimpleString(cmd);
  Py_EndInterpreter(PyThreadState_Get());
  Py_NewInterpreter();
  PyRun_SimpleString(cmd);
  Py_Finalize();
}

If the command is changed to "import sys" or "import os" there is no error message.




For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=121706&group_id=5470