summaryrefslogtreecommitdiffstats
path: root/Tools/build
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2022-11-02 18:30:09 (GMT)
committerGitHub <noreply@github.com>2022-11-02 18:30:09 (GMT)
commitf520d720f667c87f7b70ed86ea58d73892d6b969 (patch)
tree5fd8236fa0f9abfec5325b8de3d409cb72ad9bd6 /Tools/build
parent276d77724f2373cc03838448a3e62977aa28bf0d (diff)
downloadcpython-f520d720f667c87f7b70ed86ea58d73892d6b969.zip
cpython-f520d720f667c87f7b70ed86ea58d73892d6b969.tar.gz
cpython-f520d720f667c87f7b70ed86ea58d73892d6b969.tar.bz2
gh-99016: Make build scripts compatible with Python 3.8 (GH-99017)
Diffstat (limited to 'Tools/build')
-rw-r--r--Tools/build/generate_levenshtein_examples.py4
-rw-r--r--Tools/build/generate_opcode_h.py2
2 files changed, 3 insertions, 3 deletions
diff --git a/Tools/build/generate_levenshtein_examples.py b/Tools/build/generate_levenshtein_examples.py
index 5a8360f..778eb45 100644
--- a/Tools/build/generate_levenshtein_examples.py
+++ b/Tools/build/generate_levenshtein_examples.py
@@ -1,7 +1,7 @@
"""Generate 10,000 unique examples for the Levenshtein short-circuit tests."""
import argparse
-from functools import cache
+from functools import lru_cache
import json
import os.path
from random import choices, randrange
@@ -22,7 +22,7 @@ def _substitution_cost(ch_a, ch_b):
return _MOVE_COST
-@cache
+@lru_cache(None)
def levenshtein(a, b):
if not a or not b:
return (len(a) + len(b)) * _MOVE_COST
diff --git a/Tools/build/generate_opcode_h.py b/Tools/build/generate_opcode_h.py
index 372221a..174573a 100644
--- a/Tools/build/generate_opcode_h.py
+++ b/Tools/build/generate_opcode_h.py
@@ -108,7 +108,7 @@ def main(opcode_py, outfile='Include/opcode.h', internaloutfile='Include/interna
opname_including_specialized[255] = 'DO_TRACING'
used[255] = True
- with (open(outfile, 'w') as fobj, open(internaloutfile, 'w') as iobj):
+ with open(outfile, 'w') as fobj, open(internaloutfile, 'w') as iobj:
fobj.write(header)
iobj.write(internal_header)