[Python-checkins] r65858 - in python/branches/release25-maint: Lib/ctypes/__init__.py Misc/NEWS

thomas.heller python-checkins at python.org
Tue Aug 19 19:17:38 CEST 2008


Author: thomas.heller
Date: Tue Aug 19 19:17:37 2008
New Revision: 65858

Log:
issue #3554: ctypes.string_at and ctypes.wstring_at must use the
pythonapi calling convention so that the GIL is held and error return
values are checked.


Modified:
   python/branches/release25-maint/Lib/ctypes/__init__.py
   python/branches/release25-maint/Misc/NEWS

Modified: python/branches/release25-maint/Lib/ctypes/__init__.py
==============================================================================
--- python/branches/release25-maint/Lib/ctypes/__init__.py	(original)
+++ python/branches/release25-maint/Lib/ctypes/__init__.py	Tue Aug 19 19:17:37 2008
@@ -485,7 +485,7 @@
 def cast(obj, typ):
     return _cast(obj, obj, typ)
 
-_string_at = CFUNCTYPE(py_object, c_void_p, c_int)(_string_at_addr)
+_string_at = PYFUNCTYPE(py_object, c_void_p, c_int)(_string_at_addr)
 def string_at(ptr, size=-1):
     """string_at(addr[, size]) -> string
 
@@ -497,7 +497,7 @@
 except ImportError:
     pass
 else:
-    _wstring_at = CFUNCTYPE(py_object, c_void_p, c_int)(_wstring_at_addr)
+    _wstring_at = PYFUNCTYPE(py_object, c_void_p, c_int)(_wstring_at_addr)
     def wstring_at(ptr, size=-1):
         """wstring_at(addr[, size]) -> string
 

Modified: python/branches/release25-maint/Misc/NEWS
==============================================================================
--- python/branches/release25-maint/Misc/NEWS	(original)
+++ python/branches/release25-maint/Misc/NEWS	Tue Aug 19 19:17:37 2008
@@ -77,6 +77,10 @@
 Library
 -------
 
+- Issue #3554: ctypes.string_at and ctypes.wstring_at did call Python
+  api functions without holding the GIL, which could lead to a fatal
+  error when they failed.
+
 - Issue #2234: distutils failed for some versions of the cygwin compiler. The
   version reported by these tools does not necessarily follow the python
   version numbering scheme, so the module is less strict when parsing it.


More information about the Python-checkins mailing list