mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
#13096: Fix segfault in CTypes POINTER handling of large values.
Patch by Meador Inge.
This commit is contained in:
parent
4cfb5bee89
commit
817905b239
3 changed files with 19 additions and 2 deletions
|
|
@ -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, int,
|
||||
int, int, int, int, 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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue