[issue11464] Call Mac API Crash via ctypes

Ronald Oussoren report at bugs.python.org
Sat Mar 12 00:17:35 CET 2011


Ronald Oussoren <ronaldoussoren at mac.com> added the comment:

This is almost certainly not a bug in Python, but in the code in this issue.


CGEventGetLocation() is a function that returns a CGPoint, while ctypes assumes that function returns value of C type int. The effect of this is that ctypes will create the wrong stack frame during the call and that messes things up. 

That this works in 32-bit mode is more or less an accident, the calling conventions in 32-bit mode are different than that in 64-bit mode and this happens to work.

To get this code to function correctly you need to add annotations to the function object using ctypes, that documentation for ctypes in the stdlib reference explains how to do so.

I therefore propose to close this issue.

----------
nosy: +ronaldoussoren
type:  -> crash

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11464>
_______________________________________


More information about the Python-bugs-list mailing list