[pypy-commit] pypy ctypes_char_indexing: no string if we're array of char
Alecsandru Patrascu
pypy.commits at gmail.com
Wed Jun 7 02:06:00 EDT 2017
Author: Alecsandru Patrascu <alecsandru.patrascu at rinftech.com>
Branch: ctypes_char_indexing
Changeset: r91551:dd4db811a46e
Date: 2017-05-29 16:25 +0300
http://bitbucket.org/pypy/pypy/changeset/dd4db811a46e/
Log: no string if we're array of char
diff --git a/lib_pypy/_ctypes/array.py b/lib_pypy/_ctypes/array.py
--- a/lib_pypy/_ctypes/array.py
+++ b/lib_pypy/_ctypes/array.py
@@ -76,12 +76,6 @@
return self._type_._alignmentofinstances()
def _CData_output(self, resarray, base=None, index=-1):
- # this seems to be a string if we're array of char, surprise!
- from ctypes import c_char, c_wchar
- if self._type_ is c_char:
- return _rawffi.charp2string(resarray.buffer, self._length_)
- if self._type_ is c_wchar:
- return _rawffi.wcharp2unicode(resarray.buffer, self._length_)
res = self.__new__(self)
ffiarray = self._ffiarray.fromaddress(resarray.buffer, self._length_)
res._buffer = ffiarray
More information about the pypy-commit
mailing list