Message239239
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. |
|
Date |
User |
Action |
Args |
2015-03-25 09:24:13 | eryksun | set | recipients:
+ eryksun, tim.golden, python-dev, zach.ware, steve.dower |
2015-03-25 09:24:13 | eryksun | set | messageid: <1427275453.18.0.284487534801.issue23765@psf.upfronthosting.co.za> |
2015-03-25 09:24:13 | eryksun | link | issue23765 messages |
2015-03-25 09:24:12 | eryksun | create | |
|