[pypy-svn] r47452 - pypy/dist/pypy/rpython/lltypesystem
arigo at codespeak.net
arigo at codespeak.net
Sun Oct 14 21:13:40 CEST 2007
Author: arigo
Date: Sun Oct 14 21:13:38 2007
New Revision: 47452
Modified:
pypy/dist/pypy/rpython/lltypesystem/ll2ctypes.py
Log:
Better error message when we switch the two arguments to rffi.cast()
Modified: pypy/dist/pypy/rpython/lltypesystem/ll2ctypes.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/ll2ctypes.py (original)
+++ pypy/dist/pypy/rpython/lltypesystem/ll2ctypes.py Sun Oct 14 21:13:38 2007
@@ -599,6 +599,8 @@
def force_cast(RESTYPE, value):
"""Cast a value to a result type, trying to use the same rules as C."""
+ if not isinstance(RESTYPE, lltype.LowLevelType):
+ raise TypeError("rffi.cast() first arg should be a TYPE")
TYPE1 = lltype.typeOf(value)
cvalue = lltype2ctypes(value)
cresulttype = get_ctypes_type(RESTYPE)
More information about the Pypy-commit
mailing list