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

noreply@sourceforge.net noreply@sourceforge.net
Thu, 18 Jan 2001 19:47:05 -0800


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

Project: Python
Category: Extension Modules
Status: Open
Resolution: None
Bug Group: None
Priority: 6
Submitted by: mhagger
Assigned to : bwarsaw
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.




Follow-Ups:

Date: 2001-Jan-18 19:47
By: gvanrossum

Comment:
Barry, please look into this!

-------------------------------------------------------

Date: 2000-Nov-13 12:14
By: gvanrossum

Comment:
Verified. For Barry to investigate!
-------------------------------------------------------

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