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
0ea622a5
Commit
0ea622a5
authored
Jan 31, 2011
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #8275: Fix passing of callback arguments with ctypes under Win64.
Patch by Stan Mihai. Ok'ed by Georg.
parent
bd0c8973
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
55 additions
and
1 deletion
+55
-1
Lib/ctypes/test/test_callbacks.py
Lib/ctypes/test/test_callbacks.py
+36
-0
Misc/ACKS
Misc/ACKS
+1
-0
Misc/NEWS
Misc/NEWS
+3
-0
Modules/_ctypes/_ctypes_test.c
Modules/_ctypes/_ctypes_test.c
+14
-0
Modules/_ctypes/libffi_msvc/ffi.c
Modules/_ctypes/libffi_msvc/ffi.c
+1
-1
No files found.
Lib/ctypes/test/test_callbacks.py
View file @
0ea622a5
...
@@ -200,6 +200,42 @@ class SampleCallbacksTestCase(unittest.TestCase):
...
@@ -200,6 +200,42 @@ class SampleCallbacksTestCase(unittest.TestCase):
windll
.
user32
.
EnumWindows
(
EnumWindowsCallbackFunc
,
0
)
windll
.
user32
.
EnumWindows
(
EnumWindowsCallbackFunc
,
0
)
def
test_callback_register_int
(
self
):
# Issue #8275: buggy handling of callback args under Win64
# NOTE: should be run on release builds as well
dll
=
CDLL
(
_ctypes_test
.
__file__
)
CALLBACK
=
CFUNCTYPE
(
c_int
,
c_int
,
c_int
,
c_int
,
c_int
,
c_int
)
# All this function does is call the callback with its args squared
func
=
dll
.
_testfunc_cbk_reg_int
func
.
argtypes
=
(
c_int
,
c_int
,
c_int
,
c_int
,
c_int
,
CALLBACK
)
func
.
restype
=
c_int
def
callback
(
a
,
b
,
c
,
d
,
e
):
return
a
+
b
+
c
+
d
+
e
result
=
func
(
2
,
3
,
4
,
5
,
6
,
CALLBACK
(
callback
))
self
.
assertEqual
(
result
,
callback
(
2
*
2
,
3
*
3
,
4
*
4
,
5
*
5
,
6
*
6
))
def
test_callback_register_double
(
self
):
# Issue #8275: buggy handling of callback args under Win64
# NOTE: should be run on release builds as well
dll
=
CDLL
(
_ctypes_test
.
__file__
)
CALLBACK
=
CFUNCTYPE
(
c_double
,
c_double
,
c_double
,
c_double
,
c_double
,
c_double
)
# All this function does is call the callback with its args squared
func
=
dll
.
_testfunc_cbk_reg_double
func
.
argtypes
=
(
c_double
,
c_double
,
c_double
,
c_double
,
c_double
,
CALLBACK
)
func
.
restype
=
c_double
def
callback
(
a
,
b
,
c
,
d
,
e
):
return
a
+
b
+
c
+
d
+
e
result
=
func
(
1.1
,
2.2
,
3.3
,
4.4
,
5.5
,
CALLBACK
(
callback
))
self
.
assertEqual
(
result
,
callback
(
1.1
*
1.1
,
2.2
*
2.2
,
3.3
*
3.3
,
4.4
*
4.4
,
5.5
*
5.5
))
################################################################
################################################################
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
...
...
Misc/ACKS
View file @
0ea622a5
...
@@ -574,6 +574,7 @@ Luke Mewburn
...
@@ -574,6 +574,7 @@ Luke Mewburn
Mike Meyer
Mike Meyer
Steven Miale
Steven Miale
Trent Mick
Trent Mick
Stan Mihai
Aristotelis Mikropoulos
Aristotelis Mikropoulos
Damien Miller
Damien Miller
Chad Miller
Chad Miller
...
...
Misc/NEWS
View file @
0ea622a5
...
@@ -13,6 +13,9 @@ Core and Builtins
...
@@ -13,6 +13,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #8275: Fix passing of callback arguments with ctypes under Win64.
Patch by Stan Mihai.
What's New in Python 3.2 Release Candidate 2?
What's New in Python 3.2 Release Candidate 2?
=============================================
=============================================
...
...
Modules/_ctypes/_ctypes_test.c
View file @
0ea622a5
...
@@ -12,6 +12,20 @@
...
@@ -12,6 +12,20 @@
/* some functions handy for testing */
/* some functions handy for testing */
EXPORT
(
int
)
_testfunc_cbk_reg_int
(
int
a
,
int
b
,
int
c
,
int
d
,
int
e
,
int
(
*
func
)(
int
,
int
,
int
,
int
,
int
))
{
return
func
(
a
*
a
,
b
*
b
,
c
*
c
,
d
*
d
,
e
*
e
);
}
EXPORT
(
double
)
_testfunc_cbk_reg_double
(
double
a
,
double
b
,
double
c
,
double
d
,
double
e
,
double
(
*
func
)(
double
,
double
,
double
,
double
,
double
))
{
return
func
(
a
*
a
,
b
*
b
,
c
*
c
,
d
*
d
,
e
*
e
);
}
EXPORT
(
void
)
testfunc_array
(
int
values
[
4
])
EXPORT
(
void
)
testfunc_array
(
int
values
[
4
])
{
{
printf
(
"testfunc_array %d %d %d %d
\n
"
,
printf
(
"testfunc_array %d %d %d %d
\n
"
,
...
...
Modules/_ctypes/libffi_msvc/ffi.c
View file @
0ea622a5
...
@@ -380,7 +380,7 @@ ffi_prep_closure_loc (ffi_closure* closure,
...
@@ -380,7 +380,7 @@ ffi_prep_closure_loc (ffi_closure* closure,
short
bytes
;
short
bytes
;
char
*
tramp
;
char
*
tramp
;
#ifdef _WIN64
#ifdef _WIN64
int
mask
;
int
mask
=
0
;
#endif
#endif
FFI_ASSERT
(
cif
->
abi
==
FFI_SYSV
);
FFI_ASSERT
(
cif
->
abi
==
FFI_SYSV
);
...
...
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