Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion electrum/_vendor/distutils/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,14 @@ def __str__ (self):


def __repr__ (self):
return "LooseVersion ('%s')" % str(self)
# Fast path: avoid python's slow %-format and str() call
# Exploit that __str__ just returns self.vstring for LooseVersion
try:
s = self.vstring
except AttributeError:
s = str(self)
# This uses f-string, which is faster than % formatting
return f"LooseVersion ('{s}')"


def _cmp (self, other):
Expand Down