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
c2255ac1
Commit
c2255ac1
authored
Feb 07, 2013
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix test_from_dll* in test_returnfuncptrs.py.
parent
b98e96a2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
Lib/ctypes/test/test_returnfuncptrs.py
Lib/ctypes/test/test_returnfuncptrs.py
+4
-5
No files found.
Lib/ctypes/test/test_returnfuncptrs.py
View file @
c2255ac1
...
@@ -34,31 +34,30 @@ class ReturnFuncPtrTestCase(unittest.TestCase):
...
@@ -34,31 +34,30 @@ class ReturnFuncPtrTestCase(unittest.TestCase):
self
.
assertRaises
(
ArgumentError
,
strchr
,
b"abcdef"
,
3.0
)
self
.
assertRaises
(
ArgumentError
,
strchr
,
b"abcdef"
,
3.0
)
self
.
assertRaises
(
TypeError
,
strchr
,
b"abcdef"
)
self
.
assertRaises
(
TypeError
,
strchr
,
b"abcdef"
)
@
unittest
.
skipIf
(
os
.
name
==
'nt'
,
'Temporarily disabled for Windows'
)
def
test_from_dll
(
self
):
def
test_from_dll
(
self
):
dll
=
CDLL
(
_ctypes_test
.
__file__
)
dll
=
CDLL
(
_ctypes_test
.
__file__
)
# _CFuncPtr instances are now callable with a tuple argument
# _CFuncPtr instances are now callable with a tuple argument
# which denotes a function name and a dll:
# which denotes a function name and a dll:
strchr
=
CFUNCTYPE
(
c_char_p
,
c_char_p
,
c_char
)((
"strchr"
,
dll
))
strchr
=
CFUNCTYPE
(
c_char_p
,
c_char_p
,
c_char
)((
"
my_
strchr"
,
dll
))
self
.
assertTrue
(
strchr
(
b"abcdef"
,
b"b"
),
"bcdef"
)
self
.
assertTrue
(
strchr
(
b"abcdef"
,
b"b"
),
"bcdef"
)
self
.
assertEqual
(
strchr
(
b"abcdef"
,
b"x"
),
None
)
self
.
assertEqual
(
strchr
(
b"abcdef"
,
b"x"
),
None
)
self
.
assertRaises
(
ArgumentError
,
strchr
,
b"abcdef"
,
3.0
)
self
.
assertRaises
(
ArgumentError
,
strchr
,
b"abcdef"
,
3.0
)
self
.
assertRaises
(
TypeError
,
strchr
,
b"abcdef"
)
self
.
assertRaises
(
TypeError
,
strchr
,
b"abcdef"
)
@
unittest
.
skipIf
(
os
.
name
==
'nt'
,
'Temporarily disabled for Windows'
)
# Issue 6083: Reference counting bug
# Issue 6083: Reference counting bug
def
test_from_dll_refcount
(
self
):
def
test_from_dll_refcount
(
self
):
class
BadSequence
(
tuple
):
class
BadSequence
(
tuple
):
def
__getitem__
(
self
,
key
):
def
__getitem__
(
self
,
key
):
if
key
==
0
:
if
key
==
0
:
return
"strchr"
return
"
my_
strchr"
if
key
==
1
:
if
key
==
1
:
return
CDLL
(
_ctypes_test
.
__file__
)
return
CDLL
(
_ctypes_test
.
__file__
)
raise
IndexError
raise
IndexError
# _CFuncPtr instances are now callable with a tuple argument
# _CFuncPtr instances are now callable with a tuple argument
# which denotes a function name and a dll:
# which denotes a function name and a dll:
strchr
=
CFUNCTYPE
(
c_char_p
,
c_char_p
,
c_char
)(
BadSequence
((
"strchr"
,
CDLL
(
_ctypes_test
.
__file__
))))
strchr
=
CFUNCTYPE
(
c_char_p
,
c_char_p
,
c_char
)(
BadSequence
((
"my_strchr"
,
CDLL
(
_ctypes_test
.
__file__
))))
self
.
assertTrue
(
strchr
(
b"abcdef"
,
b"b"
),
"bcdef"
)
self
.
assertTrue
(
strchr
(
b"abcdef"
,
b"b"
),
"bcdef"
)
self
.
assertEqual
(
strchr
(
b"abcdef"
,
b"x"
),
None
)
self
.
assertEqual
(
strchr
(
b"abcdef"
,
b"x"
),
None
)
self
.
assertRaises
(
ArgumentError
,
strchr
,
b"abcdef"
,
3.0
)
self
.
assertRaises
(
ArgumentError
,
strchr
,
b"abcdef"
,
3.0
)
...
...
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