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 @@ -26,6 +26,9 @@ Library
2626- Issue #21396: Fix TextIOWrapper(..., write_through=True) to not force a
2727 flush() on the underlying binary stream. Patch by akira.
2828
29+ - Issue #21398: Fix an unicode error in the pydoc pager when the documentation
30+ contains characters not encodable to the stdout encoding.
31+
2932Tests
3033-----
3134
You can’t perform that action at this time.
0 commit comments