Skip to content

Commit 54a0bd8

Browse files
authored
Add a comment about _typeshed to VERSIONS (#5447)
1 parent 1ea3d0f commit 54a0bd8

File tree

4 files changed

+18
-17
lines changed

4 files changed

+18
-17
lines changed

.github/workflows/mypy_primer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
# fail action if exit code isn't zero or one
4545
(
4646
mypy_primer \
47-
--new 551eea3697 --old 551eea3697 \
47+
--new c605579af8 --old c605579af8 \
4848
--custom-typeshed-repo typeshed_to_test \
4949
--new-typeshed $GITHUB_SHA --old-typeshed upstream_master \
5050
--num-shards 2 --shard-index ${{ matrix.shard-index }} \

stdlib/VERSIONS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# The structure of this file is as follows:
2-
# - Blank lines and lines starting with `#` are ignored.
2+
# - Blank lines and comments starting with `#` are ignored.
33
# - Lines contain the name of a module, followed by a colon,
44
# a space, and a version range (for example: `symbol: 2.7-3.9`).
55
#
@@ -48,7 +48,7 @@ _thread: 2.7-
4848
_threading_local: 3.6-
4949
_tkinter: 2.7-
5050
_tracemalloc: 3.6-
51-
_typeshed: 2.7-
51+
_typeshed: 2.7- # not present at runtime, only for type checking
5252
_warnings: 2.7-
5353
_weakref: 2.7-
5454
_weakrefset: 2.7-

tests/check_consistent.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ def check_versions():
107107
with open("stdlib/VERSIONS") as f:
108108
data = f.read().splitlines()
109109
for line in data:
110-
if not line or line.lstrip().startswith("#"):
110+
line = line.split("#")[0].strip()
111+
if line == "":
111112
continue
112113
m = _VERSIONS_RE.match(line)
113114
if not m:

tests/mypy_test.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -75,19 +75,19 @@ def match(fn, args, exclude_list):
7575

7676

7777
def parse_versions(fname):
78-
with open(fname) as f:
79-
data = f.read().splitlines()
8078
result = {}
81-
for line in data:
82-
# Allow having some comments or empty lines.
83-
if not line.strip() or line.startswith("#"):
84-
continue
85-
m = _VERSION_LINE_RE.match(line)
86-
assert m, "invalid VERSIONS line :" + line
87-
mod = m.group(1)
88-
min_version = parse_version(m.group(2))
89-
max_version = parse_version(m.group(3)) if m.group(3) else (99, 99)
90-
result[mod] = min_version, max_version
79+
with open(fname) as f:
80+
for line in f:
81+
# Allow having some comments or empty lines.
82+
line = line.split("#")[0].strip()
83+
if line == "":
84+
continue
85+
m = _VERSION_LINE_RE.match(line)
86+
assert m, "invalid VERSIONS line: " + line
87+
mod = m.group(1)
88+
min_version = parse_version(m.group(2))
89+
max_version = parse_version(m.group(3)) if m.group(3) else (99, 99)
90+
result[mod] = min_version, max_version
9191
return result
9292

9393

@@ -96,7 +96,7 @@ def parse_versions(fname):
9696

9797
def parse_version(v_str):
9898
m = _VERSION_RE.match(v_str)
99-
assert m, "invalid version :" + v_str
99+
assert m, "invalid version: " + v_str
100100
return int(m.group(1)), int(m.group(2))
101101

102102

0 commit comments

Comments
 (0)