mirror of https://github.com/python/cpython.git
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. ........
This commit is contained in:
parent
7f807b79d8
commit
1a530917e2
|
@ -2207,6 +2207,13 @@ These are the fundamental ctypes data types:
|
||||||
Represents the C :ctype:`size_t` datatype.
|
Represents the C :ctype:`size_t` datatype.
|
||||||
|
|
||||||
|
|
||||||
|
.. class:: c_ssize_t
|
||||||
|
|
||||||
|
Represents the C :ctype:`ssize_t` datatype.
|
||||||
|
|
||||||
|
.. versionadded:: 3.2
|
||||||
|
|
||||||
|
|
||||||
.. class:: c_ubyte
|
.. class:: c_ubyte
|
||||||
|
|
||||||
Represents the C :ctype:`unsigned char` datatype, it interprets the value as
|
Represents the C :ctype:`unsigned char` datatype, it interprets the value as
|
||||||
|
|
|
@ -459,10 +459,13 @@ def WinError(code=None, descr=None):
|
||||||
|
|
||||||
if sizeof(c_uint) == sizeof(c_void_p):
|
if sizeof(c_uint) == sizeof(c_void_p):
|
||||||
c_size_t = c_uint
|
c_size_t = c_uint
|
||||||
|
c_ssize_t = c_int
|
||||||
elif sizeof(c_ulong) == sizeof(c_void_p):
|
elif sizeof(c_ulong) == sizeof(c_void_p):
|
||||||
c_size_t = c_ulong
|
c_size_t = c_ulong
|
||||||
|
c_ssize_t = c_long
|
||||||
elif sizeof(c_ulonglong) == sizeof(c_void_p):
|
elif sizeof(c_ulonglong) == sizeof(c_void_p):
|
||||||
c_size_t = c_ulonglong
|
c_size_t = c_ulonglong
|
||||||
|
c_ssize_t = c_longlong
|
||||||
|
|
||||||
# functions
|
# functions
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
# Test specifically-sized containers.
|
# Test specifically-sized containers.
|
||||||
|
|
||||||
import unittest
|
|
||||||
from ctypes import *
|
from ctypes import *
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
|
||||||
class SizesTestCase(unittest.TestCase):
|
class SizesTestCase(unittest.TestCase):
|
||||||
def test_8(self):
|
def test_8(self):
|
||||||
self.assertEqual(1, sizeof(c_int8))
|
self.assertEqual(1, sizeof(c_int8))
|
||||||
|
@ -23,5 +26,9 @@ def test_64(self):
|
||||||
def test_size_t(self):
|
def test_size_t(self):
|
||||||
self.assertEqual(sizeof(c_void_p), sizeof(c_size_t))
|
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__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
|
@ -717,6 +717,8 @@ Library
|
||||||
- Issue #1068268: The subprocess module now handles EINTR in internal
|
- Issue #1068268: The subprocess module now handles EINTR in internal
|
||||||
os.waitpid and os.read system calls where appropriate.
|
os.waitpid and os.read system calls where appropriate.
|
||||||
|
|
||||||
|
- Issue #6729: Added ctypes.c_ssize_t to represent ssize_t.
|
||||||
|
|
||||||
Extension Modules
|
Extension Modules
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue