[pypy-commit] pypy py3.5: fix error message
arigo
pypy.commits at gmail.com
Mon Feb 6 07:05:46 EST 2017
Author: Armin Rigo <arigo at tunes.org>
Branch: py3.5
Changeset: r89970:f0493a5ae4d6
Date: 2017-02-06 13:05 +0100
http://bitbucket.org/pypy/pypy/changeset/f0493a5ae4d6/
Log: fix error message
diff --git a/lib-python/3/test/test_extcall.py b/lib-python/3/test/test_extcall.py
--- a/lib-python/3/test/test_extcall.py
+++ b/lib-python/3/test/test_extcall.py
@@ -57,7 +57,7 @@
Traceback (most recent call last):
...
TypeError: ...got multiple values for keyword argument 'a'
- >>> f(1, 2, a=3, **{'a': 4}, **{'a': 5})
+ >>> f(1, 2, a=3, **{'a': 4}, **{'a': 5}) #doctest: +ELLIPSIS
Traceback (most recent call last):
...
TypeError: ...got multiple values for keyword argument 'a'
diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py
--- a/pypy/interpreter/pyopcode.py
+++ b/pypy/interpreter/pyopcode.py
@@ -1470,8 +1470,13 @@
for i in range(itemcount-1, -1, -1):
w_item = self.peekvalue(i)
if not space.ismapping_w(w_item):
- raise oefmt(space.w_TypeError,
- "'%T' object is not a mapping", w_item)
+ if not with_call:
+ raise oefmt(space.w_TypeError,
+ "'%T' object is not a mapping", w_item)
+ else:
+ raise oefmt(space.w_TypeError,
+ "argument after ** must be a mapping, not %T",
+ w_item)
if with_call:
expected_length += space.len_w(w_item)
space.call_method(w_dict, 'update', w_item)
diff --git a/pypy/interpreter/test/test_interpreter.py b/pypy/interpreter/test/test_interpreter.py
--- a/pypy/interpreter/test/test_interpreter.py
+++ b/pypy/interpreter/test/test_interpreter.py
@@ -340,7 +340,7 @@
assert self.codetest(code, "g1", []) == (3, 7)
resg2 = self.codetest(code, 'g2', [])
assert "TypeError:" in resg2
- assert "'list' object is not a mapping" in resg2
+ assert "argument after ** must be a mapping, not list" in resg2
resg3 = self.codetest(code, 'g3', [])
assert "TypeError:" in resg3
assert "keywords must be strings" in resg3
More information about the pypy-commit
mailing list