Author: Armin Rigo <[email protected]>
Branch:
Changeset: r86809:ce916c69cf00
Date: 2016-09-01 09:35 +0200
http://bitbucket.org/pypy/pypy/changeset/ce916c69cf00/
Log: Add a passing test that direct running and annotation both crash if
we give a float to an llexternal function expecting an int
diff --git a/rpython/rtyper/lltypesystem/test/test_rffi.py
b/rpython/rtyper/lltypesystem/test/test_rffi.py
--- a/rpython/rtyper/lltypesystem/test/test_rffi.py
+++ b/rpython/rtyper/lltypesystem/test/test_rffi.py
@@ -38,6 +38,24 @@
xf = self.compile(f, [])
assert xf() == 8+3
+ def test_no_float_to_int_conversion(self):
+ c_source = py.code.Source("""
+ int someexternalfunction(int x)
+ {
+ return (x + 3);
+ }
+ """)
+
+ eci = ExternalCompilationInfo(separate_module_sources=[c_source])
+ z = llexternal('someexternalfunction', [Signed], Signed,
+ compilation_info=eci)
+
+ def f():
+ return z(8.2)
+
+ py.test.raises(TypeError, f)
+ py.test.raises(TypeError, self.compile, f, [])
+
def test_hashdefine(self):
h_source = """
#define X(i) (i+3)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit