Author: Armin Rigo <ar...@tunes.org> Branch: py3.5 Changeset: r89094:96366ab75bb6 Date: 2016-12-16 12:35 +0100 http://bitbucket.org/pypy/pypy/changeset/96366ab75bb6/
Log: test and fix for bytes.__rmod__ diff --git a/pypy/objspace/std/bytesobject.py b/pypy/objspace/std/bytesobject.py --- a/pypy/objspace/std/bytesobject.py +++ b/pypy/objspace/std/bytesobject.py @@ -684,6 +684,8 @@ return mod_format(space, self, w_values, fmt_type=FORMAT_BYTES) def descr_rmod(self, space, w_values): + if not isinstance(w_values, W_AbstractBytesObject): + return space.w_NotImplemented return mod_format(space, w_values, self, fmt_type=FORMAT_BYTES) @staticmethod diff --git a/pypy/objspace/std/test/test_bytesobject.py b/pypy/objspace/std/test/test_bytesobject.py --- a/pypy/objspace/std/test/test_bytesobject.py +++ b/pypy/objspace/std/test/test_bytesobject.py @@ -170,6 +170,8 @@ expected2 = int_format + ' format: an integer is required, not str' assert str(exc_info.value) in (expected1, expected2) raises(TypeError, "None % 'abc'") # __rmod__ + assert b'abc'.__rmod__('-%b-') is NotImplemented + assert b'abc'.__rmod__(b'-%b-') == b'-abc-' def test_format_bytes(self): assert b'<%s>' % b'abc' == b'<abc>' _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit