changeset: 90672:3424d65ad5ce parent: 90670:53cf343c4fff parent: 90671:89a29e92416f user: Victor Stinner date: Tue May 13 02:06:33 2014 +0200 files: Misc/NEWS description: (Merge 3.4) Issue #21398: Fix an unicode error in the pydoc pager when the documentation contains characters not encodable to the stdout encoding. diff -r 53cf343c4fff -r 3424d65ad5ce Lib/pydoc.py --- a/Lib/pydoc.py Tue May 13 01:32:54 2014 +0200 +++ b/Lib/pydoc.py Tue May 13 02:06:33 2014 +0200 @@ -1404,6 +1404,9 @@ def pager(text): """The first time this is called, determine what kind of pager to use.""" global pager + # Escape non-encodable characters to avoid encoding errors later + encoding = sys.getfilesystemencoding() + text = text.encode(encoding, 'backslashreplace').decode(encoding) pager = getpager() pager(text) diff -r 53cf343c4fff -r 3424d65ad5ce Misc/NEWS --- a/Misc/NEWS Tue May 13 01:32:54 2014 +0200 +++ b/Misc/NEWS Tue May 13 02:06:33 2014 +0200 @@ -84,6 +84,9 @@ Library ------- +- Issue #21398: Fix an unicode error in the pydoc pager when the documentation + contains characters not encodable to the stdout encoding. + - Issue #16531: ipaddress.IPv4Network and ipaddress.IPv6Network now accept an (address, netmask) tuple argument, so as to easily construct network objects from existing addresses.