eryksun added the comment:
c_char_p.__repr__ (defined in __init__.py) also checks IsBadStringPtrA via FFI.
Defining the repr differently on Windows is a wart, IMO. The following repr
should be used on all platforms for c_char_p:
"%s(%s)" % (self.__class__.__name__,
c_void_p.from_buffer(self).value)
On a related note, wide-character c_wchar_p uses the default
_SimpleCData.__repr__, which calls the getfunc. It should be overridden in the
same manner as c_char_p because this can easily segfault Python on a
non-Windows platform. Even on Windows, calling IsBadStringPtrW in Z_get can't
make guarantees given multiple threads. The GIL helps, but with ctypes there's
a good chance that many threads are running concurrently.
----------
nosy: +eryksun
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue23765>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com