[pypy-issue] [issue857] u"%s" % O() that has unicode __repr__() fails

Kostya Rybnikov tracker at bugs.pypy.org
Thu Sep 1 12:53:15 CEST 2011


New submission from Kostya Rybnikov <k.bx at ya.ru>:

This code:

# -*- coding: utf-8 -*-

class O(object):
    def __repr__(self):
        return u"йцукен"

u"%s" % O()

fails:

(pypy)kost at kost-laptop:~/Ubuntu One/playground/python$ python
pypy_logging_unicode.py 
Traceback (most recent call last):
  File "app_main.py", line 53, in run_toplevel
  File "pypy_logging_unicode.py", line 7, in <module>
    u"%s" % O()
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-5:
ordinal not in range(128)

on pypy 1.6 and today's nightly build

----------
messages: 3062
nosy: k_bx, pypy-issue
priority: bug
status: unread
title: u"%s" % O() that has unicode __repr__() fails

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue857>
________________________________________


More information about the pypy-issue mailing list