8000 bpo-46463: Fixes escape4chm.py script used when building the CHM docu… · python/cpython@57d1855 · GitHub
[go: up one dir, main page]

Skip to content

Commit 57d1855

Browse files
authored
bpo-46463: Fixes escape4chm.py script used when building the CHM documentation file (GH-30768)
1 parent 65b88d5 commit 57d1855

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

Doc/tools/extensions/escape4chm.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
https://bugs.python.org/issue32174
66
"""
77

8+
import pathlib
89
import re
910
from html.entities import codepoint2name
1011

@@ -39,12 +40,12 @@ def fixup_keywords(app, exception):
3940
return
4041

4142
getLogger(__name__).info('fixing HTML escapes in keywords file...')
42-
outdir = app.builder.outdir
43+
outdir = pathlib.Path(app.builder.outdir)
4344
outname = app.builder.config.htmlhelp_basename
44-
with app.builder.open_file(outdir, outname + '.hhk', 'r') as f:
45+
with open(outdir / (outname + '.hhk'), 'rb') as f:
4546
index = f.read()
46-
with app.builder.open_file(outdir, outname + '.hhk', 'w') as f:
47-
f.write(index.replace(''', '''))
47+
with open(outdir / (outname + '.hhk'), 'wb') as f:
48+
f.write(index.replace(b''', b'''))
4849

4950
def setup(app):
5051
# `html-page-context` event emitted when the HTML builder has
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fixes :file:`escape4chm.py` script used when building the CHM documentation
2+
file

0 commit comments

Comments
 (0)
0