File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2580,7 +2580,7 @@ def bltinlink(name):
25802580 def html_getfile (path ):
25812581 """Get and display a source file listing safely."""
25822582 path = path .replace ('%20' , ' ' )
2583- with open (path , 'r' ) as fp :
2583+ with tokenize . open (path ) as fp :
25842584 lines = html .escape (fp .read ())
25852585 body = '<pre>%s</pre>' % lines
25862586 heading = html .heading (
Original file line number Diff line number Diff line change @@ -27,6 +27,10 @@ Library
2727- Issue #12467: warnings: fix a race condition if a warning is emitted at
2828 shutdown, if globals()['__file__'] is None.
2929
30+ - Issue #12451: pydoc: html_getfile() now uses tokenize.open() to support
31+ Python scripts using a encoding different than UTF-8 (read the coding cookie
32+ of the script).
33+
3034- Issue #12451: pydoc: importfile() now opens the Python script in binary mode,
3135 instead of text mode using the locale encoding, to avoid encoding issues.
3236
You can’t perform that action at this time.
0 commit comments