File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1404,6 +1404,9 @@ def bold(self, text):
14041404def pager (text ):
14051405 """The first time this is called, determine what kind of pager to use."""
14061406 global pager
1407+ # Escape non-encodable characters to avoid encoding errors later
1408+ encoding = sys .getfilesystemencoding ()
1409+ text = text .encode (encoding , 'backslashreplace' ).decode (encoding )
14071410 pager = getpager ()
14081411 pager (text )
14091412
Original file line number Diff line number Diff line change @@ -84,6 +84,9 @@ Core and Builtins
8484Library
8585-------
8686
87+ - Issue #21398: Fix an unicode error in the pydoc pager when the documentation
88+ contains characters not encodable to the stdout encoding.
89+
8790- Issue #16531: ipaddress.IPv4Network and ipaddress.IPv6Network now accept
8891 an (address, netmask) tuple argument, so as to easily construct network
8992 objects from existing addresses.
You can’t perform that action at this time.
0 commit comments