Skip to content

Commit 3859271

Browse files
committed
Assert that "version" file was a normal file
This satisfies typecheckers, which are worried about the case where extractfile returns None. That doesn't bother me too much, since if it happens it's an error condition anyway. This will make it so non-optimized runs will get a somewhat nicer message in the unlikely event that this happens.
1 parent d6eeeba commit 3859271

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

update.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ def find_latest_version() -> str:
139139
fobj = io.BytesIO(r.content)
140140
with tarfile.open(fileobj=fobj, mode="r:gz") as tf:
141141
vfile = tf.extractfile("version")
142+
143+
assert vfile is not None, "version file is not a regular file"
142144
version = vfile.read().decode("utf-8").strip()
143145

144146
assert re.match("\d{4}[a-z]$", version), version

0 commit comments

Comments
 (0)