[New-bugs-announce] [issue42852] pprint fails in transformming non-breaking space

Xinmeng Xia report at bugs.python.org
Thu Jan 7 01:47:34 EST 2021

New submission from Xinmeng Xia <xiaxm at smail.nju.edu.cn>:

"pprint" can transform unicode like "print". However, pprint fails to transform non-breaking space('\240') . See the following example:

Python 3.10.0a2 (default, Nov 24 2020, 14:18:46) 
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

Example 1(Results as expected):
>>> import pprint
>>> print(u'\041 hello')
! hello
>>> pprint.pprint(u'\041 hello')
'! hello'

Example 2(Results not as expected):
>>> print(u'\240 hello')
>>> pprint.pprint(u'\240 hello')
'\xa0 hello'

Expected output: the output of pprint.pprint(u'\240 hello') should be consistent with output of print(u'\240 hello')

components: Unicode
messages: 384564
nosy: ezio.melotti, vstinner, xxm
priority: normal
severity: normal
status: open
title: pprint fails in transformming non-breaking space
type: behavior
versions: Python 3.10

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list