[New-bugs-announce] [issue4584] doctest fails to display bytes type

Michael Yang report at bugs.python.org
Sun Dec 7 22:44:07 CET 2008


New submission from Michael Yang <yangofzeal at gmail.com>:

doctest.testmod() fails when attempting to echo back a bytes type with
ord() > 128.


def ok():
   """
>>> bytes([255,])
b'\xff'

"""
    pass

def notOK():
    """
>>> b'\xff'

"""
    pass

import doctest
doctest.testmod()

Traceback (most recent call last):
...
UnicodeEncodeError: 'ascii' codec can't encode character '\xff' in
position 141: ordinal not in range(128)

----------
components: Extension Modules
messages: 77264
nosy: msyang
severity: normal
status: open
title: doctest fails to display bytes type
type: behavior
versions: Python 3.0

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4584>
_______________________________________


More information about the New-bugs-announce mailing list