Re: How to free /destroy object created by PyTuple_New

2009-04-06 Thread Hrvoje Niksic
grbgooglefan writes: > Regarding PyTuple_New, when I pass this tuple with variable values > set to some evaluation function like PyObject_CallObject, do I need > to increment reference for this tuple & then decrement again after > the call returns? You don't. It is assumed that you already own

Re: How to free /destroy object created by PyTuple_New

2009-04-05 Thread grbgooglefan
Regarding PyTuple_New, when I pass this tuple with variable values set to some evaluation function like PyObject_CallObject, do I need to increment reference for this tuple & then decrement again after the call returns? If I've not configured my libpython with threads when compiling, will PyGILSta

Re: How to free /destroy object created by PyTuple_New

2009-04-05 Thread Hrvoje Niksic
[ You can also ask questions like this on the specialized capi-sig list; see http://mail.python.org/mailman/listinfo/capi-sig ] grbgooglefan writes: > In my case, my C application has multiple threads & they are accessing > a single Python Interpreter which was initialized by 1st main thread.

Re: How to free /destroy object created by PyTuple_New

2009-04-04 Thread grbgooglefan
On Apr 4, 10:27 pm, Andrew Svetlov wrote: > To destroy every python object you need to call Py_DECREF. > To call python code fron you C thread you need to use pair > PyGILState_Ensure/PyGILState_Release. In my case, my C application has multiple threads & they are accessing a single Python Interp

Re: How to free /destroy object created by PyTuple_New

2009-04-04 Thread Andrew Svetlov
To destroy every python object you need to call Py_DECREF. To call python code fron you C thread you need to use pair PyGILState_Ensure/PyGILState_Release. -- http://mail.python.org/mailman/listinfo/python-list

How to free /destroy object created by PyTuple_New

2009-04-04 Thread grbgooglefan
I am using PyTuple_New to pass function arguments to PyObject_CallObject for execution of a Python function. How can I free up the memory and object allocated by the PyTuple_New function? I am using Python interpreter in my multi-threaded C application & at load condition my application crashes