A question about the use of PyArg_Parse function

Barak Azulay bazulay at sphera.com
Thu Mar 31 19:00:11 CEST 2005


Hi,
 
I hope I'm writing to the right place. 
In case I'm out of place can you please refer to the right direction.
 
 
I have a question about the correct way to use PyArg_Parse API function.
I'm writing a C module to be called from python code  (ver 2.3.4)  
In one of the function I have to cast the parameter into char *
 
It looks like this:
 
PyObject* myfunc (PyObject *self, PyObject *args)
{
 char * myparam;
 
 if (!PyArg_Parse(args, "(s)", &myparam)){
    .....
}
...
}
 
I have a few questions:
 
1. is this the correct way to cast PyObject  into char* 
    I have tried the PyArg_ParseTuple but for some reason didn't succeed.
2. Is the pointer above (&myparam) is alocated by this call? ( I guess it is since the adress changed before and after the call)
3. Who is releasing this memory ?
 
 
I tried looking into the code , and will continue to.
 
I hope you'll be able to help me.
 
thanks anyway. 
_____________________________ 
Barak Azulay Software Development - Team Leader  <http://www.sphera.com/> Sphera - Web Hosting Automation Office:  972-3-9008236 
Mobile: 972-54-7773040 
Email:   bazulay at sphera.com _____________________________ 
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20050331/761d0ac8/attachment.html>


More information about the Python-list mailing list