[New-bugs-announce] [issue1306] Embedded python reinitialization

Karemir report at bugs.python.org
Sat Oct 20 15:35:10 CEST 2007


New submission from Karemir:

Hi, 
I'm embedding stackless python in a c++ application under linux. When I 
try to Finalize and Initialize again, I'm getting errors. this is a 
sample code that doesn't work:

int main() {
        Py_Initialize();
        Py_Finalize();
        Py_Initialize();
        Py_Finalize();
}

Second call to Init throws out a nice Segmentation Fault. Here's a 
stack trace:

PyDict_SetItem (op=0x0, key=0x2aaaaab1a4c8, value=0x6bab20) at 
Objects/dictobject.c:616
616             if (!PyDict_Check(op)) {
Current language:  auto; currently c
(gdb) bt
#0  PyDict_SetItem (op=0x0, key=0x2aaaaab1a4c8, value=0x6bab20) at 
Objects/dictobject.c:616
#1  0x0000000000476ac9 in PyDict_SetItemString (v=0x0, 
key=Variable "key" is not available.
) at Objects/dictobject.c:2178
#2  0x00000000004ea77f in PyErr_PrintEx (set_sys_last_vars=1) at 
Python/pythonrun.c:1098
#3  0x00000000004ebfb9 in Py_InitializeEx (install_sigs=1) at 
Python/pythonrun.c:995
#4  0x000000000044a8cc in main () at main.cpp:23

I'm using gcc 3.4.6, and Python 2.5.1 Stackless 3.1b3.

----------
components: Interpreter Core
messages: 56603
nosy: Karemir
severity: urgent
status: open
title: Embedded python reinitialization
type: crash
versions: Python 2.5

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1306>
__________________________________


More information about the New-bugs-announce mailing list