This is an automated email from the ASF dual-hosted git repository.

sbp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-release.git


The following commit(s) were added to refs/heads/main by this push:
     new 2457549  Fix a bug in the database sentinel code
2457549 is described below

commit 245754978526d0b0927af1a82201be006f91af0e
Author: Sean B. Palmer <[email protected]>
AuthorDate: Fri Sep 12 14:58:26 2025 +0100

    Fix a bug in the database sentinel code
---
 atr/db/__init__.py    | 10 +++++-----
 atr/db/interaction.py |  9 ++++++---
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/atr/db/__init__.py b/atr/db/__init__.py
index d126e13..c5e9d9d 100644
--- a/atr/db/__init__.py
+++ b/atr/db/__init__.py
@@ -62,7 +62,7 @@ class NotSet:
 
     _instance = None
 
-    def __new__(cls):  # type: ignore
+    def __new__(cls) -> NotSet:
         if cls._instance is None:
             cls._instance = super().__new__(cls)
         return cls._instance
@@ -70,11 +70,11 @@ class NotSet:
     def __repr__(self) -> str:
         return "<NotSet>"
 
-    def __copy__(self):  # type: ignore
-        return NotSet
+    def __copy__(self) -> NotSet:
+        return NotSet()
 
-    def __deepcopy__(self, memo: dict[int, Any]):  # type: ignore
-        return NotSet
+    def __deepcopy__(self, memo: dict[int, Any]) -> NotSet:
+        return NotSet()
 
 
 NOT_SET: Final[NotSet] = NotSet()
diff --git a/atr/db/interaction.py b/atr/db/interaction.py
index 5ef3ed8..28a4385 100644
--- a/atr/db/interaction.py
+++ b/atr/db/interaction.py
@@ -91,12 +91,15 @@ async def all_releases(project: sql.Project) -> 
list[sql.Release]:
     try:
         # This rejects any non PEP 440 versions
         results.sort(key=lambda r: version.Version(r.version), reverse=True)
-    except Exception:
+    except Exception as e:
+        # Usually packaging.version.InvalidVersion
+        if not isinstance(e, version.InvalidVersion):
+            log.warning(f"Error sorting releases: {type(e)}: {e!s}")
 
         def sort_key(release: sql.Release) -> tuple[tuple[int, int | str], 
...]:
             parts = []
-            version = release.version.replace("+", ".").replace("-", ".")
-            for part in version.split("."):
+            v = release.version.replace("+", ".").replace("-", ".")
+            for part in v.split("."):
                 try:
                     # Numeric parts: (0, number) to sort before strings
                     parts.append((0, int(part)))


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to