Author: Daniel Patrick <[email protected]>
Branch: py3.5
Changeset: r87421:8bfd0fa78952
Date: 2016-09-27 19:21 +0100
http://bitbucket.org/pypy/pypy/changeset/8bfd0fa78952/
Log: Make int() called with invalid argument type raise error message
consistent with CPython Existing test was failing when run with
--python=python3
diff --git a/pypy/objspace/std/intobject.py b/pypy/objspace/std/intobject.py
--- a/pypy/objspace/std/intobject.py
+++ b/pypy/objspace/std/intobject.py
@@ -886,8 +886,8 @@
if not e.match(space, space.w_TypeError):
raise
raise oefmt(space.w_TypeError,
- "int() argument must be a string or a number, "
- "not '%T'", w_value)
+ "int() argument must be a string, a bytes-like "
+ "object or a number, not '%T'", w_value)
else:
return _string_to_int_or_long(space, w_inttype, w_value, buf)
else:
diff --git a/pypy/objspace/std/test/test_intobject.py
b/pypy/objspace/std/test/test_intobject.py
--- a/pypy/objspace/std/test/test_intobject.py
+++ b/pypy/objspace/std/test/test_intobject.py
@@ -501,8 +501,8 @@
def test_int_error_msg(self):
e = raises(TypeError, int, [])
- assert str(e.value) == (
- "int() argument must be a string or a number, not 'list'")
+ assert str(e.value) == ("int() argument must be a string, a bytes-"
+ "like object or a number, not 'list'")
def test_invalid_literal_message(self):
import sys
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit