Changes by Steve Dower steve.do...@microsoft.com:
--
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23765
___
___
Roundup Robot added the comment:
New changeset 585e555247ac by Steve Dower in branch 'default':
Issue #23765: Remove IsBadStringPtr calls in ctypes
https://hg.python.org/cpython/rev/585e555247ac
--
nosy: +python-dev
___
Python tracker
Changes by Steve Dower steve.do...@microsoft.com:
--
resolution: - fixed
stage: needs patch - resolved
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23765
___
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__,
Steve Dower added the comment:
Thanks, I forgot to scan .py files.
--
status: closed - open
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23765
___
eryksun 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)
I suggested switching to using from_buffer:
c_void_p.from_buffer(self).value
from_buffer is more efficient. cast() is imlemented as an FFI
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 *
Steve Dower added the comment:
Ah okay, I understand better what your suggestion was trying to achieve now. I
agree, we should just show the address in repr - I'll make that change to both
c_char_p and c_wchar_p.
--
___
Python tracker
Roundup Robot added the comment:
New changeset 339d90983e29 by Steve Dower in branch 'default':
Issue #23765: Removed IsBadStringPtr calls in ctypes
https://hg.python.org/cpython/rev/339d90983e29
--
___
Python tracker rep...@bugs.python.org
New submission from Steve Dower:
Modules/_ctypes/cfield.c has this horror in it (twice):
/* XXX What about invalid pointers ??? */
if (*(void **)ptr) {
#if defined(MS_WIN32) !defined(_WIN32_WCE)
if (IsBadStringPtrA(*(char **)ptr, -1)) {
Tim Golden added the comment:
Unless someone comes back who remembers what the ulterior motive was: I
agree; remove the check and just the crash happen.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23765
11 matches
Mail list logo