summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-01-21 22:11:47 (GMT)
committerGitHub <noreply@github.com>2022-01-21 22:11:47 (GMT)
commitd548c871716dfda73714d9f38b4e4219878a414e (patch)
tree35e15033c58d2b9fb7c1463db966ea6a30249832 /Doc
parent05063fa15c594012e6dc9c2c7a3ea72e7cb933f2 (diff)
downloadcpython-d548c871716dfda73714d9f38b4e4219878a414e.zip
cpython-d548c871716dfda73714d9f38b4e4219878a414e.tar.gz
cpython-d548c871716dfda73714d9f38b4e4219878a414e.tar.bz2
bpo-46463: Fixes escape4chm.py script used when building the CHM documentation file (GH-30768)
(cherry picked from commit 57d1855682dbeb9233ef3a531f9535c6442e9992) Co-authored-by: Steve Dower <steve.dower@python.org>
Diffstat (limited to 'Doc')
-rw-r--r--Doc/tools/extensions/escape4chm.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/Doc/tools/extensions/escape4chm.py b/Doc/tools/extensions/escape4chm.py
index e999971..8997097 100644
--- a/Doc/tools/extensions/escape4chm.py
+++ b/Doc/tools/extensions/escape4chm.py
@@ -5,6 +5,7 @@ effect on some MBCS Windows systems.
https://bugs.python.org/issue32174
"""
+import pathlib
import re
from html.entities import codepoint2name
@@ -39,12 +40,12 @@ def fixup_keywords(app, exception):
return
getLogger(__name__).info('fixing HTML escapes in keywords file...')
- outdir = app.builder.outdir
+ outdir = pathlib.Path(app.builder.outdir)
outname = app.builder.config.htmlhelp_basename
- with app.builder.open_file(outdir, outname + '.hhk', 'r') as f:
+ with open(outdir / (outname + '.hhk'), 'rb') as f:
index = f.read()
- with app.builder.open_file(outdir, outname + '.hhk', 'w') as f:
- f.write(index.replace('&#x27;', '&#39;'))
+ with open(outdir / (outname + '.hhk'), 'wb') as f:
+ f.write(index.replace(b'&#x27;', b'&#39;'))
def setup(app):
# `html-page-context` event emitted when the HTML builder has