Skip to content

Commit f520d72

Browse files
gh-99016: Make build scripts compatible with Python 3.8 (GH-99017)
1 parent 276d777 commit f520d72

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix build with ``PYTHON_FOR_REGEN=python3.8``.

Tools/build/generate_levenshtein_examples.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Generate 10,000 unique examples for the Levenshtein short-circuit tests."""
22

33
import argparse
4-
from functools import cache
4+
from functools import lru_cache
55
import json
66
import os.path
77
from random import choices, randrange
@@ -22,7 +22,7 @@ def _substitution_cost(ch_a, ch_b):
2222
return _MOVE_COST
2323

2424

25-
@cache
25+
@lru_cache(None)
2626
def levenshtein(a, b):
2727
if not a or not b:
2828
return (len(a) + len(b)) * _MOVE_COST

Tools/build/generate_opcode_h.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def main(opcode_py, outfile='Include/opcode.h', internaloutfile='Include/interna
108108
opname_including_specialized[255] = 'DO_TRACING'
109109
used[255] = True
110110

111-
with (open(outfile, 'w') as fobj, open(internaloutfile, 'w') as iobj):
111+
with open(outfile, 'w') as fobj, open(internaloutfile, 'w') as iobj:
112112
fobj.write(header)
113113
iobj.write(internal_header)
114114

0 commit comments

Comments
 (0)