[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,])


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


import doctest

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>

More information about the New-bugs-announce mailing list