commit:     fc70635aecbf80d3aeeb9f4e56d396040da09279
Author:     Siddhanth Rathod <xsiddhanthrathod <AT> gmail <DOT> com>
AuthorDate: Sun Oct  8 09:25:15 2023 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Oct  8 19:47:56 2023 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=fc70635a

Fix: move msg array such that it gets assigned only when needed

Signed-off-by: Siddhanth Rathod <xsiddhanthrathod <AT> gmail.com>
Closes: https://github.com/gentoo/portage/pull/1124
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 lib/portage/dbapi/bintree.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/portage/dbapi/bintree.py b/lib/portage/dbapi/bintree.py
index 7a4166c120..421863f3e8 100644
--- a/lib/portage/dbapi/bintree.py
+++ b/lib/portage/dbapi/bintree.py
@@ -1092,10 +1092,10 @@ class binarytree:
                             missing_keys.append("PF")
                         if not slot:
                             missing_keys.append("SLOT")
-                        msg = []
-                        if missing_keys:
-                            missing_keys.sort()
-                            if invalid_errors:
+                        if invalid_errors:
+                            msg = []
+                            if missing_keys:
+                                missing_keys.sort()
                                 msg.append(
                                     _("Missing metadata key(s): %s.")
                                     % ", ".join(missing_keys)

Reply via email to