[New-bugs-announce] [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>

More information about the New-bugs-announce mailing list