This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eryksun
Recipients eryksun, python-dev, steve.dower, tim.golden, zach.ware
Date 2015-03-25.09:24:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1427275453.18.0.284487534801.issue23765@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2015-03-25 09:24:13eryksunsetrecipients: + eryksun, tim.golden, python-dev, zach.ware, steve.dower
2015-03-25 09:24:13eryksunsetmessageid: <1427275453.18.0.284487534801.issue23765@psf.upfronthosting.co.za>
2015-03-25 09:24:13eryksunlinkissue23765 messages
2015-03-25 09:24:12eryksuncreate