mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +00:00
gh-99016: Make build scripts compatible with Python 3.8 (GH-99017)
This commit is contained in:
parent
276d77724f
commit
f520d720f6
3 changed files with 4 additions and 3 deletions
|
@ -0,0 +1 @@
|
||||||
|
Fix build with ``PYTHON_FOR_REGEN=python3.8``.
|
|
@ -1,7 +1,7 @@
|
||||||
"""Generate 10,000 unique examples for the Levenshtein short-circuit tests."""
|
"""Generate 10,000 unique examples for the Levenshtein short-circuit tests."""
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
from functools import cache
|
from functools import lru_cache
|
||||||
import json
|
import json
|
||||||
import os.path
|
import os.path
|
||||||
from random import choices, randrange
|
from random import choices, randrange
|
||||||
|
@ -22,7 +22,7 @@ def _substitution_cost(ch_a, ch_b):
|
||||||
return _MOVE_COST
|
return _MOVE_COST
|
||||||
|
|
||||||
|
|
||||||
@cache
|
@lru_cache(None)
|
||||||
def levenshtein(a, b):
|
def levenshtein(a, b):
|
||||||
if not a or not b:
|
if not a or not b:
|
||||||
return (len(a) + len(b)) * _MOVE_COST
|
return (len(a) + len(b)) * _MOVE_COST
|
||||||
|
|
|
@ -108,7 +108,7 @@ def main(opcode_py, outfile='Include/opcode.h', internaloutfile='Include/interna
|
||||||
opname_including_specialized[255] = 'DO_TRACING'
|
opname_including_specialized[255] = 'DO_TRACING'
|
||||||
used[255] = True
|
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)
|
fobj.write(header)
|
||||||
iobj.write(internal_header)
|
iobj.write(internal_header)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue