From fa47dad041bf9878702724dba9d0ca4152fab928 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Tue, 14 Jun 2011 16:07:43 -0400 Subject: python: Implement virStreamSend/Recv The return values for the python version are different that the C version of virStreamSend: on success we return a string, an error raises an exception, and if the stream would block we return int(-2). We need to do this since strings aren't passed by reference in python. --- typewrappers.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'typewrappers.c') diff --git a/typewrappers.c b/typewrappers.c index e39d3cd..b5758b4 100644 --- a/typewrappers.c +++ b/typewrappers.c @@ -76,6 +76,20 @@ libvirt_ulonglongWrap(unsigned long long val) return (ret); } +PyObject * +libvirt_charPtrSizeWrap(char *str, Py_ssize_t size) +{ + PyObject *ret; + + if (str == NULL) { + Py_INCREF(Py_None); + return (Py_None); + } + ret = PyString_FromStringAndSize(str, size); + free(str); + return (ret); +} + PyObject * libvirt_charPtrWrap(char *str) { -- cgit