Skip to content

Commit

Permalink
Merge pull request #11922 from collinanderson/patch-1
Browse files Browse the repository at this point in the history
Avoid parsing dist.version twice in a row
  • Loading branch information
sbidoul authored Apr 10, 2023
2 parents 42b19ab + fc29515 commit cd7aeb7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/pip/_internal/operations/freeze.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,10 @@ def freeze(


def _format_as_name_version(dist: BaseDistribution) -> str:
if isinstance(dist.version, Version):
return f"{dist.raw_name}=={dist.version}"
return f"{dist.raw_name}==={dist.version}"
dist_version = dist.version
if isinstance(dist_version, Version):
return f"{dist.raw_name}=={dist_version}"
return f"{dist.raw_name}==={dist_version}"


def _get_editable_info(dist: BaseDistribution) -> _EditableInfo:
Expand Down

0 comments on commit cd7aeb7

Please sign in to comment.