libftdi Archives

Subject: Re: RE: ftdi.write_data doesn’t work with some python3 unicode strings

From: Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Cc: Michel Zou <xantares09@xxxxxxxxxxx>
Date: Thu, 05 Nov 2015 17:56:58 +0100
On Thursday, 5. November 2015 15:13:52 Michel Zou wrote:
> inline char * str2charp_size(PyObject* pyObj, int * size)
> {
>   char * v_ = 0;
> #if PY_MAJOR_VERSION >= 3
>   PyBytes_AsStringAndSize(pyObj, &v_, (Py_ssize_t*)size);
> #else
>   PyString_AsStringAndSize(pyObj, &v_, (Py_ssize_t*)size);
> #endif
>   return v_;
> }

thanks, looking good! Patch committed with the above change.

Cheers,
Thomas


--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread