A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2007-February/071366.html below:

[Python-Dev] Embedded Python:: C/Python: Is Py_Finalize() necessary between embedded function calls?

[Python-Dev] Embedded Python:: C/Python: Is Py_Finalize() necessary between embedded function calls? [Python-Dev] Embedded Python:: C/Python: Is Py_Finalize() necessary between embedded function calls?Sydney Pang sydney.pang at gmail.com
Fri Feb 23 13:24:19 CET 2007
Hi, I am developing an application where I have Python embedded in C 
functions using the C/Python API to execute commands. My question stems 
from my need to preserve a PyObject to pass between these Python 
embedded C functions. My question is: do I have to call Py_Finalize() at 
the end of each Python embedded C function?

The abstract structure of my code looks like this:

PyObject *po;

main() {
    po = py_function_1();
   
    // some C code in the middle here...

    po = py_function_2(po);

    // some more C code here...
}

In my implementation of py_function_1 and py_function_2 do I have to 
call Py_Initialize() and Py_Finalize at the beginning and end of each of 
the two functions? Or can I just call Py_Initialize at the beginning of 
py_function_1 and then call Py_Finalize() at the end of py_function_2?

Thank You.
SP
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4