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
9ccf4683
Commit
9ccf4683
authored
Jul 12, 2007
by
Thomas Heller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test_slicing does not segfault under linux anymore, so we can run this
test by default.
parent
7775c716
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
40 deletions
+38
-40
Lib/ctypes/test/test_slicing.py
Lib/ctypes/test/test_slicing.py
+38
-40
No files found.
Lib/ctypes/test/test_slicing.py
View file @
9ccf4683
...
...
@@ -34,47 +34,45 @@ class SlicesTestCase(unittest.TestCase):
# ValueError: Can only assign sequence of same size
self
.
assertRaises
(
ValueError
,
setslice
,
a
,
0
,
5
,
range
(
32
))
from
ctypes.test
import
is_resource_enabled
if
is_resource_enabled
(
"struni-crash"
):
def
test_char_ptr
(
self
):
s
=
b"abcdefghijklmnopqrstuvwxyz"
dll
=
CDLL
(
_ctypes_test
.
__file__
)
dll
.
my_strdup
.
restype
=
POINTER
(
c_char
)
dll
.
my_free
.
restype
=
None
def
test_char_ptr
(
self
):
s
=
b"abcdefghijklmnopqrstuvwxyz"
dll
=
CDLL
(
_ctypes_test
.
__file__
)
dll
.
my_strdup
.
restype
=
POINTER
(
c_char
)
dll
.
my_free
.
restype
=
None
res
=
dll
.
my_strdup
(
s
)
self
.
failUnlessEqual
(
res
[:
len
(
s
)],
s
)
import
operator
self
.
assertRaises
(
TypeError
,
operator
.
setslice
,
res
,
0
,
5
,
"abcde"
)
dll
.
my_free
(
res
)
dll
.
my_strdup
.
restype
=
POINTER
(
c_byte
)
res
=
dll
.
my_strdup
(
s
)
self
.
failUnlessEqual
(
res
[:
len
(
s
)],
list
(
range
(
ord
(
"a"
),
ord
(
"z"
)
+
1
)))
dll
.
my_free
(
res
)
def
test_char_ptr_with_free
(
self
):
dll
=
CDLL
(
_ctypes_test
.
__file__
)
s
=
b"abcdefghijklmnopqrstuvwxyz"
class
allocated_c_char_p
(
c_char_p
):
pass
dll
.
my_free
.
restype
=
None
def
errcheck
(
result
,
func
,
args
):
retval
=
result
.
value
dll
.
my_free
(
result
)
return
retval
dll
.
my_strdup
.
restype
=
allocated_c_char_p
dll
.
my_strdup
.
errcheck
=
errcheck
try
:
res
=
dll
.
my_strdup
(
s
)
self
.
failUnlessEqual
(
res
[:
len
(
s
)],
s
)
import
operator
self
.
assertRaises
(
TypeError
,
operator
.
setslice
,
res
,
0
,
5
,
"abcde"
)
dll
.
my_free
(
res
)
dll
.
my_strdup
.
restype
=
POINTER
(
c_byte
)
res
=
dll
.
my_strdup
(
s
)
self
.
failUnlessEqual
(
res
[:
len
(
s
)],
list
(
range
(
ord
(
"a"
),
ord
(
"z"
)
+
1
)))
dll
.
my_free
(
res
)
def
test_char_ptr_with_free
(
self
):
dll
=
CDLL
(
_ctypes_test
.
__file__
)
s
=
b"abcdefghijklmnopqrstuvwxyz"
class
allocated_c_char_p
(
c_char_p
):
pass
dll
.
my_free
.
restype
=
None
def
errcheck
(
result
,
func
,
args
):
retval
=
result
.
value
dll
.
my_free
(
result
)
return
retval
dll
.
my_strdup
.
restype
=
allocated_c_char_p
dll
.
my_strdup
.
errcheck
=
errcheck
try
:
res
=
dll
.
my_strdup
(
s
)
self
.
failUnlessEqual
(
res
,
s
)
finally
:
del
dll
.
my_strdup
.
errcheck
self
.
failUnlessEqual
(
res
,
s
)
finally
:
del
dll
.
my_strdup
.
errcheck
def
test_char_array
(
self
):
...
...
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