[getdns-api] string from dict bindata

Melinda Shore melinda.shore at nomountain.net
Mon May 2 00:40:58 UTC 2016


On 5/1/16 12:14 PM, Tom Pusateri wrote:
> Are we supposed to peek inside of bindata and assume the bytes and length are string data?

Yes, unfortunately you need to know what type of data
are being returned in each dictionary element, but if you
do it's extremely reliable.  bindata->size holds the
string length.  I've found that bindata strings do not
always have a terminal \0, so in the Python bindings I'm
doing string conversions using PyString_FromStringAndSize()
rather than just PyString_FromString().

Melinda




More information about the Users mailing list