[issue23765] Remove IsBadStringPtr calls in ctypes

Steve Dower report at bugs.python.org
Wed Mar 25 23:47:09 CET 2015


Steve Dower added the comment:

So the repr that's there for c_char_p is currently::

    "%s(%s)" % (self.__class__.__name__, cast(self, c_void_p).value)

But if I remove the override then it renders the value as b'abc'. Basically, we can have one of:

>>> from ctypes import *
>>> cast(create_string_buffer(b'abc'), c_char_p)
c_char_p(b'abc')

or

>>> cast(create_string_buffer(b'abc'), c_char_p)
c_char_p(52808208)

I prefer the former (remove c_char_p.__repr__ completely), but the latter is clearly there for some reason. Any opinions?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23765>
_______________________________________


More information about the Python-bugs-list mailing list