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
745f5e2d
Commit
745f5e2d
authored
Jul 12, 2007
by
Thomas Heller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
No crashes on Linux in the ctypes test suite any longer, so we can
remove the 'crash-protection'.
parent
f4f771fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
23 deletions
+19
-23
Lib/ctypes/test/test_functions.py
Lib/ctypes/test/test_functions.py
+9
-11
Lib/ctypes/test/test_python_api.py
Lib/ctypes/test/test_python_api.py
+10
-12
No files found.
Lib/ctypes/test/test_functions.py
View file @
745f5e2d
...
...
@@ -160,17 +160,15 @@ class FunctionTestCase(unittest.TestCase):
result
=
f
(
1
,
2
,
3
,
4
,
5.0
,
6.0
,
21
)
self
.
failUnlessEqual
(
result
,
42
)
from
ctypes.test
import
is_resource_enabled
if
is_resource_enabled
(
"struni-crash"
):
def
test_stringresult
(
self
):
f
=
dll
.
_testfunc_p_p
f
.
argtypes
=
None
f
.
restype
=
c_char_p
result
=
f
(
b"123"
)
self
.
failUnlessEqual
(
result
,
"123"
)
result
=
f
(
None
)
self
.
failUnlessEqual
(
result
,
None
)
def
test_stringresult
(
self
):
f
=
dll
.
_testfunc_p_p
f
.
argtypes
=
None
f
.
restype
=
c_char_p
result
=
f
(
b"123"
)
self
.
failUnlessEqual
(
result
,
"123"
)
result
=
f
(
None
)
self
.
failUnlessEqual
(
result
,
None
)
def
test_pointers
(
self
):
f
=
dll
.
_testfunc_p_p
...
...
Lib/ctypes/test/test_python_api.py
View file @
745f5e2d
...
...
@@ -67,21 +67,19 @@ class PythonAPITestCase(unittest.TestCase):
del
pyobj
self
.
failUnlessEqual
(
grc
(
s
),
ref
)
from
ctypes.test
import
is_resource_enabled
if
is_resource_enabled
(
"struni-crash"
):
def
test_PyOS_snprintf
(
self
):
PyOS_snprintf
=
pythonapi
.
PyOS_snprintf
PyOS_snprintf
.
argtypes
=
POINTER
(
c_char
),
c_size_t
,
c_char_p
def
test_PyOS_snprintf
(
self
):
PyOS_snprintf
=
pythonapi
.
PyOS_snprintf
PyOS_snprintf
.
argtypes
=
POINTER
(
c_char
),
c_size_t
,
c_char_p
buf
=
c_buffer
(
256
)
PyOS_snprintf
(
buf
,
sizeof
(
buf
),
"Hello from %s"
,
b"ctypes"
)
self
.
failUnlessEqual
(
buf
.
value
,
"Hello from ctypes"
)
buf
=
c_buffer
(
256
)
PyOS_snprintf
(
buf
,
sizeof
(
buf
),
"Hello from %s"
,
b"ctypes"
)
self
.
failUnlessEqual
(
buf
.
value
,
"Hello from ctypes"
)
PyOS_snprintf
(
buf
,
sizeof
(
buf
),
"Hello from %s (%d, %d, %d)"
,
b"ctypes"
,
1
,
2
,
3
)
self
.
failUnlessEqual
(
buf
.
value
,
"Hello from ctypes (1, 2, 3)"
)
PyOS_snprintf
(
buf
,
sizeof
(
buf
),
"Hello from %s (%d, %d, %d)"
,
b"ctypes"
,
1
,
2
,
3
)
self
.
failUnlessEqual
(
buf
.
value
,
"Hello from ctypes (1, 2, 3)"
)
# not enough arguments
self
.
failUnlessRaises
(
TypeError
,
PyOS_snprintf
,
buf
)
# not enough arguments
self
.
failUnlessRaises
(
TypeError
,
PyOS_snprintf
,
buf
)
def
test_pyobject_repr
(
self
):
self
.
failUnlessEqual
(
repr
(
py_object
()),
"py_object(<NULL>)"
)
...
...
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