summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@python.org>2022-01-21 21:51:15 (GMT)
committerGitHub <noreply@github.com>2022-01-21 21:51:15 (GMT)
commit57d1855682dbeb9233ef3a531f9535c6442e9992 (patch)
tree4b1409a6567b68c6141a28e8fae5c49634355893
parent65b88d5e01c845c0cfa3ff61bc8b2faec8f67a57 (diff)
downloadcpython-57d1855682dbeb9233ef3a531f9535c6442e9992.zip
cpython-57d1855682dbeb9233ef3a531f9535c6442e9992.tar.gz
cpython-57d1855682dbeb9233ef3a531f9535c6442e9992.tar.bz2
bpo-46463: Fixes escape4chm.py script used when building the CHM documentation file (GH-30768)
-rw-r--r--Doc/tools/extensions/escape4chm.py9
-rw-r--r--Misc/NEWS.d/next/Documentation/2022-01-21-21-33-48.bpo-46463.fBbdTG.rst2
2 files changed, 7 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
diff --git a/Misc/NEWS.d/next/Documentation/2022-01-21-21-33-48.bpo-46463.fBbdTG.rst b/Misc/NEWS.d/next/Documentation/2022-01-21-21-33-48.bpo-46463.fBbdTG.rst
new file mode 100644
index 0000000..d418190
--- /dev/null
+++ b/Misc/NEWS.d/next/Documentation/2022-01-21-21-33-48.bpo-46463.fBbdTG.rst
@@ -0,0 +1,2 @@
+Fixes :file:`escape4chm.py` script used when building the CHM documentation
+file