no translation from Python2 "str" to C "const char*" in a struct field
Created originally on Bitbucket by zooko (Zooko O'Whielacronx)
Folks:
Thank you for CFFI!
I have a struct defined like this:
typedef struct { size_t len; char* buf; } zstr;
and I pass instance of this struct by value in C, like this:
double unigram_prob_1(const zstr unigram, Pvoid_t* pUP);
CFFI is supposed to know what to do if I pass a Python "str" as an argument where a C "const char*" is required, and it is supposed to know what to do if I pass a Python tuple where a C struct is required, but putting the two together it does not know what to do if I pass Python2 "(len(mystr), mystr)" as the first argument to unigram_prob_1(). Is this a bug, or by-design? Thanks!
(It would be great for me if it would do what I want here. I'm currently rewriting all my C code to take two arguments -- len and buf -- wherever it used to take a zstr, and this is a hassle.)