File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -237,14 +237,8 @@ class c_char(_SimpleCData):
237237
238238class c_char_p (_SimpleCData ):
239239 _type_ = "z"
240- if _os .name == "nt" :
241- def __repr__ (self ):
242- if not windll .kernel32 .IsBadStringPtrA (self , - 1 ):
243- return "%s(%r)" % (self .__class__ .__name__ , self .value )
244- return "%s(%s)" % (self .__class__ .__name__ , cast (self , c_void_p ).value )
245- else :
246- def __repr__ (self ):
247- return "%s(%s)" % (self .__class__ .__name__ , cast (self , c_void_p ).value )
240+ def __repr__ (self ):
241+ return "%s(%s)" % (self .__class__ .__name__ , c_void_p .from_buffer (self ).value )
248242_check_size (c_char_p , "P" )
249243
250244class c_void_p (_SimpleCData ):
@@ -259,6 +253,8 @@ class c_bool(_SimpleCData):
259253
260254class c_wchar_p (_SimpleCData ):
261255 _type_ = "Z"
256+ def __repr__ (self ):
257+ return "%s(%s)" % (self .__class__ .__name__ , c_void_p .from_buffer (self ).value )
262258
263259class c_wchar (_SimpleCData ):
264260 _type_ = "u"
Original file line number Diff line number Diff line change @@ -30,6 +30,8 @@ Core and Builtins
3030Library
3131-------
3232
33+ - Issue #23765: Removed IsBadStringPtr calls in ctypes
34+
3335- Issue #22364: Improved some re error messages using regex for hints.
3436
3537- Issue #23742: ntpath.expandvars() no longer loses unbalanced single quotes.
You can’t perform that action at this time.
0 commit comments