[pypy-svn] r74279 - in pypy/trunk/pypy: module/cpyext/src rpython/lltypesystem

jandem at codespeak.net jandem at codespeak.net
Fri Apr 30 14:10:56 CEST 2010


Author: jandem
Date: Fri Apr 30 14:10:54 2010
New Revision: 74279

Modified:
   pypy/trunk/pypy/module/cpyext/src/getargs.c
   pypy/trunk/pypy/rpython/lltypesystem/ll2ctypes.py
Log:
Enable 'd' en 'f' arguments in PyArg_Parse*


Modified: pypy/trunk/pypy/module/cpyext/src/getargs.c
==============================================================================
--- pypy/trunk/pypy/module/cpyext/src/getargs.c	(original)
+++ pypy/trunk/pypy/module/cpyext/src/getargs.c	Fri Apr 30 14:10:54 2010
@@ -756,8 +756,6 @@
 #endif // HAVE_LONG_LONG
 
 	case 'f': {/* float */
-    Py_FatalError("'f' unimplemented for PyArg_*\n");
-#if 0
 		float *p = va_arg(*p_va, float *);
 		double dval = PyFloat_AsDouble(arg);
 		if (PyErr_Occurred())
@@ -765,12 +763,9 @@
 		else
 			*p = (float) dval;
 		break;
-#endif
 	}
 	
 	case 'd': {/* double */
-    Py_FatalError("'d' unimplemented for PyArg_*\n");
-#if 0
 		double *p = va_arg(*p_va, double *);
 		double dval = PyFloat_AsDouble(arg);
 		if (PyErr_Occurred())
@@ -778,7 +773,6 @@
 		else
 			*p = dval;
 		break;
-#endif
 	}
 	
 #ifndef WITHOUT_COMPLEX

Modified: pypy/trunk/pypy/rpython/lltypesystem/ll2ctypes.py
==============================================================================
--- pypy/trunk/pypy/rpython/lltypesystem/ll2ctypes.py	(original)
+++ pypy/trunk/pypy/rpython/lltypesystem/ll2ctypes.py	Fri Apr 30 14:10:54 2010
@@ -1002,7 +1002,7 @@
     elif isinstance(cvalue, (str, unicode)):
         cvalue = ord(cvalue)     # character -> integer
 
-    if not isinstance(cvalue, (int, long)):
+    if not isinstance(cvalue, (int, long, float)):
         raise NotImplementedError("casting %r to %r" % (TYPE1, RESTYPE))
 
     if isinstance(RESTYPE, lltype.Ptr):



More information about the Pypy-commit mailing list