summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGregory P. Smith <greg@mad-scientist.com>2010-03-01 04:59:27 (GMT)
committerGregory P. Smith <greg@mad-scientist.com>2010-03-01 04:59:27 (GMT)
commit1a530917e20eec360252232cdeaa2cfff1caffcb (patch)
tree592cfebfdd0e3f0b4cfa04036171080a4a55187b /Lib
parent7f807b79d83df2333a777360d1e2fd8ff469f1e7 (diff)
downloadcpython-1a530917e20eec360252232cdeaa2cfff1caffcb.zip
cpython-1a530917e20eec360252232cdeaa2cfff1caffcb.tar.gz
cpython-1a530917e20eec360252232cdeaa2cfff1caffcb.tar.bz2
Merged revisions 78544 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r78544 | gregory.p.smith | 2010-02-28 20:56:12 -0800 (Sun, 28 Feb 2010) | 2 lines Adds c_ssize_t to ctypes. issue 6729. ........
Diffstat (limited to 'Lib')
-rw-r--r--Lib/ctypes/__init__.py3
-rw-r--r--Lib/ctypes/test/test_sizes.py9
2 files changed, 11 insertions, 1 deletions
diff --git a/Lib/ctypes/__init__.py b/Lib/ctypes/__init__.py
index 1283f28..8782db9 100644
--- a/Lib/ctypes/__init__.py
+++ b/Lib/ctypes/__init__.py
@@ -459,10 +459,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()