[pypy-commit] pypy default: Fail if we call an llexternal() function with more arguments than declared
arigo
pypy.commits at gmail.com
Fri Aug 26 09:27:06 EDT 2016
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r86555:fda5486b3186
Date: 2016-08-26 15:26 +0200
http://bitbucket.org/pypy/pypy/changeset/fda5486b3186/
Log: Fail if we call an llexternal() function with more arguments than
declared
diff --git a/rpython/rtyper/lltypesystem/rffi.py b/rpython/rtyper/lltypesystem/rffi.py
--- a/rpython/rtyper/lltypesystem/rffi.py
+++ b/rpython/rtyper/lltypesystem/rffi.py
@@ -237,8 +237,10 @@
" directly to a VOIDP argument")
_oops._annspecialcase_ = 'specialize:memo'
+ nb_args = len(args)
unrolling_arg_tps = unrolling_iterable(enumerate(args))
def wrapper(*args):
+ assert len(args) == nb_args
real_args = ()
# XXX 'to_free' leaks if an allocation fails with MemoryError
# and was not the first in this function
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
@@ -49,6 +49,7 @@
eci = ExternalCompilationInfo(includes=['stuff.h'],
include_dirs=[udir])
z = llexternal('X', [Signed], Signed, compilation_info=eci)
+ py.test.raises(AssertionError, z, 8, 9)
def f():
return z(8)
More information about the pypy-commit
mailing list