lenght of char buffers in PyArg_ParseTuple

P

Patrick Stinson

is there any way to figure out how long the string buffer of a passed string
object was after PyArg_ParseTuple(args, "s", &mybuffer)?

I'm potentially copying data from a call to socket.inet_pton(), which is a
string type but strlen(mybuffer) should not work in the case of a
NUL-terminator before the end of the buffer.

Cheers
 
D

Duncan Booth

is there any way to figure out how long the string buffer of a passed
string object was after PyArg_ParseTuple(args, "s", &mybuffer)?

No, but there is if you call PyArg_ParseTuple(args, "s#", &mybuffer,
&length) instead.
 

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

Forum statistics

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

Latest Threads

Top