]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-99016: Make build scripts compatible with Python 3.8 (GH-99017)
authorSerhiy Storchaka <storchaka@gmail.com>
Wed, 2 Nov 2022 18:30:09 +0000 (20:30 +0200)
committerGitHub <noreply@github.com>
Wed, 2 Nov 2022 18:30:09 +0000 (20:30 +0200)
Misc/NEWS.d/next/Build/2022-11-02-19-25-07.gh-issue-99016.R05NkD.rst [new file with mode: 0644]
Tools/build/generate_levenshtein_examples.py
Tools/build/generate_opcode_h.py

diff --git a/Misc/NEWS.d/next/Build/2022-11-02-19-25-07.gh-issue-99016.R05NkD.rst b/Misc/NEWS.d/next/Build/2022-11-02-19-25-07.gh-issue-99016.R05NkD.rst
new file mode 100644 (file)
index 0000000..df189da
--- /dev/null
@@ -0,0 +1 @@
+Fix build with ``PYTHON_FOR_REGEN=python3.8``.
index 5a8360fff7315a74c30ddcec018524fb82524445..778eb458c541c070e64e4b699795bc699a3af45c 100644 (file)
@@ -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
index 372221a14d07e1190c10d84f4d68a803d0a21205..174573a3c64b08e5c2fb9b1a79df8c729c7e12d7 100644 (file)
@@ -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)