summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Heller <theller@ctypes.org>2008-08-19 17:17:37 +0000
committerThomas Heller <theller@ctypes.org>2008-08-19 17:17:37 +0000
commit275e229ee2e95ea906cc6260dc3b5af9f14b15ff (patch)
tree14ae82f7390837d84d679986e35cc0f4cc8b67a0
parent22679b869cdbe85b8e01595b660ffca07d22bfa8 (diff)
downloadcpython-git-275e229ee2e95ea906cc6260dc3b5af9f14b15ff.tar.gz
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.
-rw-r--r--Lib/ctypes/__init__.py4
-rw-r--r--Misc/NEWS4
2 files changed, 6 insertions, 2 deletions
diff --git a/Lib/ctypes/__init__.py b/Lib/ctypes/__init__.py
index ef90bc7b87..7ad9e2be19 100644
--- a/Lib/ctypes/__init__.py
+++ b/Lib/ctypes/__init__.py
@@ -485,7 +485,7 @@ _cast = PYFUNCTYPE(py_object, c_void_p, py_object, py_object)(_cast_addr)
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 @@ try:
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
diff --git a/Misc/NEWS b/Misc/NEWS
index 954ae7e4ad..82c579d0b8 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -77,6 +77,10 @@ Core and builtins
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.