Skip to content

Commit 4a4953d

Browse files
committed
perf: inline base_version
Signed-off-by: Henry Schreiner <[email protected]>
1 parent 0671b0e commit 4a4953d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/packaging/version.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,12 @@ def __str__(self) -> str:
377377
>>> str(Version("1.0a5"))
378378
'1.0a5'
379379
"""
380-
version = self.base_version
380+
# This is a hot function, so not calling self.base_version
381+
version = ".".join(map(str, self.release))
382+
383+
# Epoch
384+
if self.epoch:
385+
version = f"{self.epoch}!{version}"
381386

382387
# Pre-release
383388
if self.pre is not None:

0 commit comments

Comments
 (0)