Python C API How to pass array of structs from C to Python
For a python module I'm creating, I want to pass to the python user an array of structs like this: struct tcpstat { inet_prefix local; inet_prefix remote; int lport; int rport; int state; int rq, wq; int timer; int timeout; int retrs; unsigned ino; int probes; unsigned uid; int refcnt; unsigned long long sk; int rto, ato, qack, cwnd, ssthresh; }; I thought that Py_BuildValues was the function I was looking for. But seems like it isn't. Looking in the Python documentation I found the Buffer Protocol . But is the first time I'm developing a python module and the official documentation didn't