PyArg_ParseTuple

  • Thread starter Patrick Stinson
  • Start date
P

Patrick Stinson

does one need to deallocate memory assigned to char * buffers by
PyArg_ParseTuple?

ex:

static PyObject *myfunc(PyObject *self, PyObject *args)
{
char *stringarg=NULL;
PyArg_ParseTuple(args, "s", &stringarg);
return NULL;
}
 
J

Jeff Epler

No. You need not free(stringarg).

http://docs.python.org/api/arg-parsing.html

You must not provide storage for the string itself; a pointer to an
existing string is stored into the character pointer variable whose
address you pass.


Jeff

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAx55sJd01MZaTXX0RAptqAJ9rUly5uO6iMnsx96pqItbmlgJvUQCfeh+D
F2BKtLKI5UZlFJuBEgIJ7l8=
=a9Bj
-----END PGP SIGNATURE-----
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top