From 7b0887052c8cd8adc17aba8dd10a000a7700690d Mon Sep 17 00:00:00 2001 From: geisserml Date: Thu, 19 Oct 2023 17:33:24 +0200 Subject: [PATCH] Fix faulty version repr If no desc is present, we don't want to add a trailing "+". --- docs/devel/changelog_staging.md | 1 + src/pypdfium2/version.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/devel/changelog_staging.md b/docs/devel/changelog_staging.md index d15b83b2a..30467de5c 100644 --- a/docs/devel/changelog_staging.md +++ b/docs/devel/changelog_staging.md @@ -4,3 +4,4 @@ # Changelog for next release +- Fixed faulty version repr (avoid trailing `+` if desc is empty). diff --git a/src/pypdfium2/version.py b/src/pypdfium2/version.py index 36907913f..c9f716de6 100644 --- a/src/pypdfium2/version.py +++ b/src/pypdfium2/version.py @@ -39,7 +39,10 @@ def __setattr__(self, name, value): @cached_property def version(self): - return f"{self.tag}+{self.desc}" + v = str(self.tag) + if self.desc: + v += "+" + str(self.desc) + return v def __repr__(self): return self.version