diff options
author | Erlend E. Aasland <erlend@python.org> | 2023-12-21 12:10:41 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-21 12:10:41 (GMT) |
commit | fae096cd4b7025f91473546ca6a243c86374dd6a (patch) | |
tree | e9ab788f51cc6091bccc929fdc0b715253c6d36d /Tools/clinic | |
parent | 4b90b5d857ba88c7d85483e188a73323df9ba05c (diff) | |
download | cpython-fae096cd4b7025f91473546ca6a243c86374dd6a.zip cpython-fae096cd4b7025f91473546ca6a243c86374dd6a.tar.gz cpython-fae096cd4b7025f91473546ca6a243c86374dd6a.tar.bz2 |
gh-113336: Remove the 'version' directive from Argument Clinic (#113341)
The 'version' directive was introduced with gh-63929 in Nov 2013. It has
not been in use in the CPython code base, and the 'version' variable has
never been bumped.
Diffstat (limited to 'Tools/clinic')
-rwxr-xr-x | Tools/clinic/clinic.py | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py index 45b01a2..bf31992 100755 --- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -61,8 +61,6 @@ from typing import ( # and keyword-only # -version = '1' - NO_VARARG = "PY_SSIZE_T_MAX" CLINIC_PREFIX = "__clinic_" CLINIC_PREFIXED_ARGS = { @@ -375,49 +373,6 @@ def pprint_words(items: list[str]) -> str: return ", ".join(items[:-1]) + " and " + items[-1] -def version_splitter(s: str) -> tuple[int, ...]: - """Splits a version string into a tuple of integers. - - The following ASCII characters are allowed, and employ - the following conversions: - a -> -3 - b -> -2 - c -> -1 - (This permits Python-style version strings such as "1.4b3".) - """ - version: list[int] = [] - accumulator: list[str] = [] - def flush() -> None: - if not accumulator: - fail(f'Unsupported version string: {s!r}') - version.append(int(''.join(accumulator))) - accumulator.clear() - - for c in s: - if c.isdigit(): - accumulator.append(c) - elif c == '.': - flush() - elif c in 'abc': - flush() - version.append('abc'.index(c) - 3) - else: - fail(f'Illegal character {c!r} in version string {s!r}') - flush() - return tuple(version) - -def version_comparator(version1: str, version2: str) -> Literal[-1, 0, 1]: - iterator = itertools.zip_longest( - version_splitter(version1), version_splitter(version2), fillvalue=0 - ) - for a, b in iterator: - if a < b: - return -1 - if a > b: - return 1 - return 0 - - class CRenderData: def __init__(self) -> None: @@ -5262,13 +5217,6 @@ class DSLParser: self.critical_section = False self.target_critical_section = [] - def directive_version(self, required: str) -> None: - global version - if version_comparator(version, required) < 0: - fail("Insufficient Clinic version!\n" - f" Version: {version}\n" - f" Required: {required}") - def directive_module(self, name: str) -> None: fields = name.split('.')[:-1] module, cls = self.clinic._module_and_class(fields) |