You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The 4th parameter of method always None or 0 on x64 Windows. #54093
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2011-02-01.02:02:21.044>created_at=<Date2010-09-17.09:11:56.670>labels= ['type-bug', 'OS-windows']
title='The 4th parameter of method always None or 0 on x64 Windows.'updated_at=<Date2011-02-01.02:02:21.043>user='https://bugs.python.org/owenl'
I have try to call python method from c++ dll by "WINFUNCTYPE".
But the 4th parameter is always None or 0 if the type is int or void* (float is works fine).
Following is the part of source code:
==code==========================================
I tested this issue in Python2.7.1, Python3.1.3 and Python 3.2rc1. It's still can reproduce. Would you please check this "Callback functions" issue?
cgohlke commented on Jan 21, 2011
cgohlkemannequin
Mannequin
More actions
The provided example has two problems: The DLL should be loaded as cdll, not windll. C_METHOD_TYPE4 uses c_int32 as parameter type while pyFunc4Type in testPy2.cpp uses LPVOID (64 bit on win-amd64). Even with those corrections the issue remains.
owenl commented on Jan 21, 2011
owenlmannequin
MannequinAuthor
More actions
yes, I tried lots of types. The issue still happens. The same case in Ubuntu and Mac were works well.
cgohlke commented on Jan 21, 2011
cgohlkemannequin
Mannequin
More actions
The patch attached to bpo-8275 fixes this issue and possibly also bpo-9266.
Tested with Python 2.7.1 64 bit on Windows 7.
owenl commented on Jan 21, 2011
owenlmannequin
MannequinAuthor
More actions
wow~~~ It works on my PC too (Windows 2003 STD x64). Thanks.
stanmihai commented on Jan 26, 2011
stanmihaimannequin
Mannequin
More actions
Disabling optimizations doesn't really fix the issue, just hides it, for now.
The problem was an uninitialized variable. Attached is the patch that fixes it.
owenl commented on Feb 1, 2011
owenlmannequin
MannequinAuthor
More actions
Thanks, this issue has been fixed. :-)
fixing revisions:
r88284 (3.2), r88285 (3.1) and r88286 (2.7)
Activity
owenl commentedon Sep 17, 2010
OS: Windows 2003STD x64 en
I have try to call python method from c++ dll by "WINFUNCTYPE".
But the 4th parameter is always None or 0 if the type is int or void* (float is works fine).
Following is the part of source code:
==code==========================================
==========================================
To my knowledge, both visual c++ and gcc use registers for the first few parameters, and then after that use the stack. Maybe this is the reason.
I have attached some simple codes for reproduce this issue.
issues
owenl commentedon Sep 19, 2010
Please reproduce this issue by 64bit Python.
owenl commentedon Sep 19, 2010
Note:
This issue also occurs on other 64 bit windows OS(i.e. windows xp 64bit)
Load "testPy2.dll" needs vc++ runtime library (http://download.microsoft.com/download/2/d/6/2d61c766-107b-409d-8fba-c39e61ca08e8/vcredist_x64.exe)
Update "testPy2.dll", use this to reproduce the issue.
python code:
import sys
from ctypes import *
#########################################
#########################################
ocean-city commentedon Oct 3, 2010
Probably this issue is duplicate of bpo-9266.
ocean-city commentedon Oct 4, 2010
I don't have x64 machine, so I cannot test this.
So this is just an idea.
It seems
Modules/_ctypes/libffi_msvc is a bit old.
Modules/_ctypes/libffi/src/x86 is newer.
Maybe this issue can be fixed by using newer one?
Thank you.
owenl commentedon Jan 21, 2011
I tested this issue in Python2.7.1, Python3.1.3 and Python 3.2rc1. It's still can reproduce. Would you please check this "Callback functions" issue?
cgohlke commentedon Jan 21, 2011
The provided example has two problems: The DLL should be loaded as cdll, not windll. C_METHOD_TYPE4 uses c_int32 as parameter type while pyFunc4Type in testPy2.cpp uses LPVOID (64 bit on win-amd64). Even with those corrections the issue remains.
owenl commentedon Jan 21, 2011
yes, I tried lots of types. The issue still happens. The same case in Ubuntu and Mac were works well.
cgohlke commentedon Jan 21, 2011
The patch attached to bpo-8275 fixes this issue and possibly also bpo-9266.
Tested with Python 2.7.1 64 bit on Windows 7.
owenl commentedon Jan 21, 2011
wow~~~ It works on my PC too (Windows 2003 STD x64). Thanks.
stanmihai commentedon Jan 26, 2011
Disabling optimizations doesn't really fix the issue, just hides it, for now.
The problem was an uninitialized variable. Attached is the patch that fixes it.
owenl commentedon Feb 1, 2011
Thanks, this issue has been fixed. :-)
fixing revisions:
r88284 (3.2), r88285 (3.1) and r88286 (2.7)