[New-bugs-announce] [issue6869] Embedded python crashed on 4th run, if "ctypes" is used

Ilya report at bugs.python.org
Wed Sep 9 10:31:15 CEST 2009


New submission from Ilya <kaplan.ilya at gmail.com>:

When embedding python from C, and importing "ctypes" module in embedded 
script, it always crashes on Py_Finalize() on 4th cycle.
Tested with both PyRun_SimpleString(...) and PyRun_String(...).
Platform: Windows XP
IDE's: LabWindows/CVI 8.5 and Code::Blocks/gcc

Code:
--------------------------
#include <stdio.h>
#include <python.h>

int main()
{
    int i;
    for (i=0; i<10; i++)
    {
        printf("--- %d ---\n", i);
        Py_Initialize();
        PyRun_SimpleString("import ctypes");
        Py_Finalize();
    }
    return 0;
}
--------------------------------
Output:
--------------------------------
--- 0 ---
--- 1 ---
--- 2 ---
--- 3 ---

Process returned -1073741819 (0xC0000005)   execution time : 3.109 s
Press any key to continue.
--------------------------------

----------
assignee: theller
components: ctypes
messages: 92444
nosy: Warlock, theller
severity: normal
status: open
title: Embedded python crashed on 4th run, if "ctypes" is used
type: crash
versions: Python 2.5, Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6869>
_______________________________________


More information about the New-bugs-announce mailing list