[pypy-commit] pypy default: Improve the error message when we mistype a keyword argument in unwrap_spec()

arigo noreply at buildbot.pypy.org
Wed Jul 4 08:28:11 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r55918:68e7e825d598
Date: 2012-07-04 08:27 +0200
http://bitbucket.org/pypy/pypy/changeset/68e7e825d598/

Log:	Improve the error message when we mistype a keyword argument in
	unwrap_spec()

diff --git a/pypy/interpreter/gateway.py b/pypy/interpreter/gateway.py
--- a/pypy/interpreter/gateway.py
+++ b/pypy/interpreter/gateway.py
@@ -496,7 +496,12 @@
 
     # apply kw_spec
     for name, spec in kw_spec.items():
-        unwrap_spec[argnames.index(name)] = spec
+        try:
+            unwrap_spec[argnames.index(name)] = spec
+        except ValueError:
+            raise ValueError("unwrap_spec() got a keyword %r but it is not "
+                             "the name of an argument of the following "
+                             "function" % (name,))
 
     return unwrap_spec
 


More information about the pypy-commit mailing list