diff options
author | Gregory P. Smith <greg@mad-scientist.com> | 2010-03-01 04:56:12 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@mad-scientist.com> | 2010-03-01 04:56:12 (GMT) |
commit | 3c699d334a1f6f413326bd8a3cbcd1a7a4b4a93d (patch) | |
tree | 0f0f33404212b59ae7aee26efaf6354b8ba6a2a8 /Lib/ctypes | |
parent | 3c1586ab45c2eb867e6c110128632191cdb51be6 (diff) | |
download | cpython-3c699d334a1f6f413326bd8a3cbcd1a7a4b4a93d.zip cpython-3c699d334a1f6f413326bd8a3cbcd1a7a4b4a93d.tar.gz cpython-3c699d334a1f6f413326bd8a3cbcd1a7a4b4a93d.tar.bz2 |
Adds c_ssize_t to ctypes. issue 6729.
Diffstat (limited to 'Lib/ctypes')
-rw-r--r-- | Lib/ctypes/__init__.py | 3 | ||||
-rw-r--r-- | Lib/ctypes/test/test_sizes.py | 9 |
2 files changed, 11 insertions, 1 deletions
diff --git a/Lib/ctypes/__init__.py b/Lib/ctypes/__init__.py index 1b03835..16489b9 100644 --- a/Lib/ctypes/__init__.py +++ b/Lib/ctypes/__init__.py @@ -462,10 +462,13 @@ _pointer_type_cache[None] = c_void_p if sizeof(c_uint) == sizeof(c_void_p): c_size_t = c_uint + c_ssize_t = c_int elif sizeof(c_ulong) == sizeof(c_void_p): c_size_t = c_ulong + c_ssize_t = c_long elif sizeof(c_ulonglong) == sizeof(c_void_p): c_size_t = c_ulonglong + c_ssize_t = c_longlong # functions diff --git a/Lib/ctypes/test/test_sizes.py b/Lib/ctypes/test/test_sizes.py index 0509cbb..f9b5e97 100644 --- a/Lib/ctypes/test/test_sizes.py +++ b/Lib/ctypes/test/test_sizes.py @@ -1,8 +1,11 @@ # Test specifically-sized containers. -import unittest from ctypes import * +import sys +import unittest + + class SizesTestCase(unittest.TestCase): def test_8(self): self.assertEqual(1, sizeof(c_int8)) @@ -23,5 +26,9 @@ class SizesTestCase(unittest.TestCase): def test_size_t(self): self.assertEqual(sizeof(c_void_p), sizeof(c_size_t)) + def test_ssize_t(self): + self.assertEqual(sizeof(c_void_p), sizeof(c_ssize_t)) + + if __name__ == "__main__": unittest.main() |