[Stackless] Bug when initializing stackless python the second time
Juho Mäkinen
juho.makinen at gmail.com
Mon Mar 20 21:37:06 CET 2006
I believe I've found a bug which is trigged when I try to initialize
Stackless Python
the second time in a program, after I have first cleaned up with Py_Finalize()
Here is the code to reproduce the bug:
Py_SetProgramName("foo");
Py_InitializeEx(0);
if (!Py_IsInitialized())
throw InitializationError();
Py_Finalize(); // This should cleanup everything, right?
if (Py_IsInitialized()) // This verifies that python is not
initialized at this point
std::cerr << "Python is already initialized!" << std::endl;
Py_SetProgramName("foo");
Py_InitializeEx(0);
At the last function, Py_InitializeEx(0), the following error is thrown:
Fatal Python error: Py_Initialize: can't init stackless types
I believe I have traced it correctly to function slp_register_execute.
The full callstack at this point it:
Py_InitializeEx() --> _PyStackless_InitTypes() -> init_cframetype()
--> slp_register_execute()
Inside slp_register_execute, the code which triggers the error is the following:
(at line 348 of prickelpit.c)
if (0
|| PyDict_GetItem(dp->dict, nameobj) != NULL
|| PyDict_GetItem(dp->dict, g) != NULL
|| PyDict_GetItem(dp->dict, b) != NULL
) {
PyErr_SetString(PyExc_SystemError,
"duplicate/ambiguous exec func");
The error message suggests that something isn't cleaning up everything right,
but as I'm not familiar with Python internals (much less Stackless internals),
I don't know how to fix this. Hopefully somebody here can =)
- Juho Mäkinen
_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless
More information about the Stackless
mailing list