diff options
author | Steve Dower <steve.dower@microsoft.com> | 2015-03-26 04:58:36 (GMT) |
---|---|---|
committer | Steve Dower <steve.dower@microsoft.com> | 2015-03-26 04:58:36 (GMT) |
commit | e6bb7eb27b8b81ed74e5132628ca8e6415baf57e (patch) | |
tree | 80cb3673b1f230131a75e8a7b6bf458de480f421 /Lib | |
parent | 632a77e6a3fb3acec9850cd5245dc28314000e54 (diff) | |
download | cpython-e6bb7eb27b8b81ed74e5132628ca8e6415baf57e.zip cpython-e6bb7eb27b8b81ed74e5132628ca8e6415baf57e.tar.gz cpython-e6bb7eb27b8b81ed74e5132628ca8e6415baf57e.tar.bz2 |
Issue #23765: Removed IsBadStringPtr calls in ctypes
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/ctypes/__init__.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/Lib/ctypes/__init__.py b/Lib/ctypes/__init__.py index 055294c..4cb6d0d 100644 --- a/Lib/ctypes/__init__.py +++ b/Lib/ctypes/__init__.py @@ -237,14 +237,8 @@ _check_size(c_char) class c_char_p(_SimpleCData): _type_ = "z" - if _os.name == "nt": - def __repr__(self): - if not windll.kernel32.IsBadStringPtrA(self, -1): - return "%s(%r)" % (self.__class__.__name__, self.value) - return "%s(%s)" % (self.__class__.__name__, cast(self, c_void_p).value) - else: - def __repr__(self): - return "%s(%s)" % (self.__class__.__name__, cast(self, c_void_p).value) + def __repr__(self): + return "%s(%s)" % (self.__class__.__name__, c_void_p.from_buffer(self).value) _check_size(c_char_p, "P") class c_void_p(_SimpleCData): @@ -259,6 +253,8 @@ from _ctypes import POINTER, pointer, _pointer_type_cache class c_wchar_p(_SimpleCData): _type_ = "Z" + def __repr__(self): + return "%s(%s)" % (self.__class__.__name__, c_void_p.from_buffer(self).value) class c_wchar(_SimpleCData): _type_ = "u" |