Author: Matti Picus <matti.pi...@gmail.com> Branch: unicode-utf8 Changeset: r95542:d9ad50294bd6 Date: 2018-12-25 22:32 +0200 http://bitbucket.org/pypy/pypy/changeset/d9ad50294bd6/
Log: raise for non-ascii.__mod__(unicode) diff --git a/pypy/objspace/std/formatting.py b/pypy/objspace/std/formatting.py --- a/pypy/objspace/std/formatting.py +++ b/pypy/objspace/std/formatting.py @@ -434,6 +434,16 @@ got_unicode = space.isinstance_w(w_value, space.w_unicode) if not do_unicode: if got_unicode: + # Make sure the format string is ascii encodable + try: + self.fmt.decode('ascii') + except UnicodeDecodeError as e: + raise OperationError(space.w_UnicodeDecodeError, + space.newtuple([space.newtext('ascii'), + space.newbytes(self.fmt), + space.newint(e.start), + space.newint(e.end), + space.newtext(e.message)])) raise NeedUnicodeFormattingError s = self.string_formatting(w_value) else: _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit