Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
3c699d33
Commit
3c699d33
authored
Mar 01, 2010
by
Gregory P. Smith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds c_ssize_t to ctypes. issue 6729.
parent
3c1586ab
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
1 deletion
+20
-1
Doc/library/ctypes.rst
Doc/library/ctypes.rst
+7
-0
Lib/ctypes/__init__.py
Lib/ctypes/__init__.py
+3
-0
Lib/ctypes/test/test_sizes.py
Lib/ctypes/test/test_sizes.py
+8
-1
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Doc/library/ctypes.rst
View file @
3c699d33
...
...
@@ -2248,6 +2248,13 @@ These are the fundamental ctypes data types:
Represents the C :ctype:`size_t` datatype.
.. class:: c_ssize_t
Represents the C :ctype:`ssize_t` datatype.
.. versionadded:: 2.7
.. class:: c_ubyte
Represents the C :ctype:`unsigned char` datatype, it interprets the value as
...
...
Lib/ctypes/__init__.py
View file @
3c699d33
...
...
@@ -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
...
...
Lib/ctypes/test/test_sizes.py
View file @
3c699d33
# 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
()
Misc/NEWS
View file @
3c699d33
...
...
@@ -78,6 +78,8 @@ Library
- Issue #1068268: The subprocess module now handles EINTR in internal
os.waitpid and os.read system calls where appropriate.
- Issue #6729: Added ctypes.c_ssize_t to represent ssize_t.
Extension Modules
-----------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment