mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
(Merge 3.4) Issue #21398: Fix an unicode error in the pydoc pager when the
documentation contains characters not encodable to the stdout encoding.
This commit is contained in:
commit
38d3d22b29
2 changed files with 6 additions and 0 deletions
|
@ -1404,6 +1404,9 @@ class _PlainTextDoc(TextDoc):
|
||||||
def pager(text):
|
def pager(text):
|
||||||
"""The first time this is called, determine what kind of pager to use."""
|
"""The first time this is called, determine what kind of pager to use."""
|
||||||
global pager
|
global pager
|
||||||
|
# Escape non-encodable characters to avoid encoding errors later
|
||||||
|
encoding = sys.getfilesystemencoding()
|
||||||
|
text = text.encode(encoding, 'backslashreplace').decode(encoding)
|
||||||
pager = getpager()
|
pager = getpager()
|
||||||
pager(text)
|
pager(text)
|
||||||
|
|
||||||
|
|
|
@ -84,6 +84,9 @@ Core and Builtins
|
||||||
Library
|
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
|
- Issue #16531: ipaddress.IPv4Network and ipaddress.IPv6Network now accept
|
||||||
an (address, netmask) tuple argument, so as to easily construct network
|
an (address, netmask) tuple argument, so as to easily construct network
|
||||||
objects from existing addresses.
|
objects from existing addresses.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue