[issue2146] ctypes: support double for calling function

STINNER Victor report at bugs.python.org
Wed Feb 20 02:55:14 CET 2008


New submission from STINNER Victor:

ctypes doesn't support transparent conversion of double arguments. 
Example code:

from ctypes import cdll, c_double
libm = cdll.LoadLibrary("libm.so")
sqrt = libm.sqrt
sqrt.argstype = (c_double,)
sqrt.restype = c_double
print sqrt(4.0)

I wrote a patch to fix it: see attached patch

----------
components: Extension Modules
files: ctypes_callproc_double.patch
messages: 62581
nosy: haypo
severity: normal
status: open
title: ctypes: support double for calling function
type: rfe
versions: Python 2.5
Added file: http://bugs.python.org/file9467/ctypes_callproc_double.patch

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2146>
__________________________________


More information about the Python-bugs-list mailing list