Skip to content

Commit

Permalink
Do not crash when a version fails to parse (#29685)
Browse files Browse the repository at this point in the history
Old files on PyPI may contain version numbers that are non-standard and
can't be properly parsed. Those are no longer allowed for new versions,
so we can safely ignore those versions since they must be ancient.
  • Loading branch information
uranusjr authored Feb 22, 2023
1 parent 19f1e7c commit 8430d60
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ def get_releases_and_upload_times(package, min_date, current_version, tz) -> lis
releases: list[tuple[Any, Any]] = []
for release_version, release_info in package_info["releases"].items():
if release_info and not release_info[0]["yanked"]:
parsed_version = version.parse(release_version)
try:
parsed_version = version.parse(release_version)
except version.InvalidVersion:
continue
if (
parsed_version.is_prerelease
or parsed_version.is_devrelease
Expand Down

0 comments on commit 8430d60

Please sign in to comment.