Py_Finalize ERROR!

Discussion in 'Python' started by zaley, Feb 19, 2008.

  1. zaley

    zaley Guest

    Py_Finalize ERROR!

    In my C++ program ,python is embeded . I create one win thread to run
    embedded Python code .
    So at the begin of thread function I call "Py_Initialize" and at the
    end of thread function call "Py_Finalize" .
    But after I began thread several times,the program crashed in
    function "Py_Finalize".
    I can see the error occured at function "PyObject_ClearWeakRefs" when
    "Py_Finalize" called "type_dealloc";

    Note: the python25.dll(lib) is builded by VC6(SP6)
    zaley, Feb 19, 2008
    #1
    1. Advertising

  2. zaley

    Guest

    On Feb 19, 12:11 am, zaley <> wrote:
    > Py_Finalize ERROR!
    >
    > In my C++ program ,python is embeded . I create one win thread to run
    > embedded Python code .
    > So at the begin of thread function I call "Py_Initialize" and at the
    > end of thread function call "Py_Finalize" .
    > But after I began thread several times,the program crashed  in
    > function  "Py_Finalize".
    > I can see the error occured at function "PyObject_ClearWeakRefs" when
    > "Py_Finalize" called "type_dealloc";
    >
    > Note: the python25.dll(lib) is builded by VC6(SP6)


    I think I ran into this error with my pgsql PL project--at some point.
    I think I "fixed" it by *not* calling Py_Finalize(). =)

    However, I'm sure a report would be welcome, so if you don't mind
    going through some hassle, I'd suggest making a trip to the bug
    tracker.
    , Feb 19, 2008
    #2
    1. Advertising

  3. On 19 feb, 05:11, zaley <> wrote:
    > Py_Finalize ERROR!
    >
    > In my C++ program ,python is embeded . I create one win thread to run
    > embedded Python code .
    > So at the begin of thread function I call "Py_Initialize" and at the
    > end of thread function call "Py_Finalize" .
    > But after I began thread several times,the program crashed  in
    > function  "Py_Finalize".
    > I can see the error occured at function "PyObject_ClearWeakRefs" when
    > "Py_Finalize" called "type_dealloc";
    >
    > Note: the python25.dll(lib) is builded by VC6(SP6)


    Try to not call repeatedly Py_Initialize/Py_Finalize, only at the
    start/end of your program. If only one thread is running Python at the
    same time I *think* you don't have to do any special handling.

    --
    Gabriel Genellina
    Gabriel Genellina, Feb 19, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kari Hallfast
    Replies:
    2
    Views:
    446
    Harri Pesonen
    Oct 23, 2003
  2. Pablo Yabo

    Py_Finalize

    Pablo Yabo, Feb 20, 2004, in forum: Python
    Replies:
    0
    Views:
    403
    Pablo Yabo
    Feb 20, 2004
  3. Roman Suzi
    Replies:
    0
    Views:
    439
    Roman Suzi
    Jan 8, 2005
  4. Roman Suzi
    Replies:
    0
    Views:
    373
    Roman Suzi
    Jan 10, 2005
  5. Robin
    Replies:
    1
    Views:
    518
    Robin
    Nov 13, 2009
Loading...

Share This Page