Skip to content

Commit

Permalink
Fix filter_version caching bug exposed after filtering nixpkgs
Browse files Browse the repository at this point in the history
  • Loading branch information
TyberiusPrime committed Jul 6, 2023
1 parent 1162c85 commit 9dfadd4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions mach_nix/requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,10 @@ def parse_reqs_line(line):

return name, extras, all_specs, build, marker


@cached(keyfunc=lambda args: hash((tuple(args[0]), args[1])))
def filter_versions(
versions: List[Version],
req: Requirement):
req: Requirement) -> List[Version]:
"""
Reduces a given list of versions to contain only versions
which are allowed according to the given specifiers
Expand All @@ -202,7 +201,7 @@ def filter_versions(
if not req.specs:
# We filter version with an empty specifier set, since that will filter
# out prerelease, if there are any other releases.
return SpecifierSet().filter(versions)
return list(SpecifierSet().filter(versions)) # return a list in both cases
matched_versions = []
for specs in req.specs:
matched_versions.extend(
Expand Down

0 comments on commit 9dfadd4

Please sign in to comment.