This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author warlock
Recipients theller, warlock
Date 2009-09-09.08:31:12
SpamBayes Score 8.5478105e-06
Marked as misclassified No
Message-id <1252485075.59.0.965228056128.issue6869@psf.upfronthosting.co.za>
In-reply-to
Content
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.
--------------------------------
History
Date User Action Args
2009-09-09 08:31:16warlocksetrecipients: + warlock, theller
2009-09-09 08:31:15warlocksetmessageid: <1252485075.59.0.965228056128.issue6869@psf.upfronthosting.co.za>
2009-09-09 08:31:13warlocklinkissue6869 messages
2009-09-09 08:31:13warlockcreate