summaryrefslogtreecommitdiffstats
path: root/Lib/ctypes
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2014-10-12 18:26:30 (GMT)
committerR David Murray <rdmurray@bitdance.com>2014-10-12 18:26:30 (GMT)
commit55bf20ad6e0bd9ca4c1b1a6dd7339972b4aa915e (patch)
tree1d1c00fcabce20b7c876966f90e3727cedb87071 /Lib/ctypes
parente73b8c64b8cc2531b21135e0d0f07de11dc76ab3 (diff)
downloadcpython-55bf20ad6e0bd9ca4c1b1a6dd7339972b4aa915e.zip
cpython-55bf20ad6e0bd9ca4c1b1a6dd7339972b4aa915e.tar.gz
cpython-55bf20ad6e0bd9ca4c1b1a6dd7339972b4aa915e.tar.bz2
#13096: Fix segfault in CTypes POINTER handling of large values.
Patch by Meador Inge.
Diffstat (limited to 'Lib/ctypes')
-rw-r--r--Lib/ctypes/test/test_pointers.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/ctypes/test/test_pointers.py b/Lib/ctypes/test/test_pointers.py
index 9531158..3e74791 100644
--- a/Lib/ctypes/test/test_pointers.py
+++ b/Lib/ctypes/test/test_pointers.py
@@ -7,6 +7,8 @@ ctype_types = [c_byte, c_ubyte, c_short, c_ushort, c_int, c_uint,
c_long, c_ulong, c_longlong, c_ulonglong, c_double, c_float]
python_types = [int, int, int, int, int, long,
int, long, long, long, float, float]
+LargeNamedType = type('T' * 2 ** 25, (Structure,), {})
+large_string = 'T' * 2 ** 25
class PointersTestCase(unittest.TestCase):
@@ -188,5 +190,11 @@ class PointersTestCase(unittest.TestCase):
mth = WINFUNCTYPE(None)(42, "name", (), None)
self.assertEqual(bool(mth), True)
+ def test_pointer_type_name(self):
+ self.assertTrue(POINTER(LargeNamedType))
+
+ def test_pointer_type_str_name(self):
+ self.assertTrue(POINTER(large_string))
+
if __name__ == '__main__':
unittest.main()