proj/portage:master commit in: lib/_emerge/

"Matt Turner" <[email protected]>
Newsgroups gmane.linux.gentoo.cvs
Message-ID <1785943558.7be15c1e0f20b58422a8b544b7ca0737b8949f9b.mattst88@gentoo>
commit:     7be15c1e0f20b58422a8b544b7ca0737b8949f9b
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Wed Aug  5 15:25:05 2026 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Wed Aug  5 15:25:58 2026 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=7be15c1e

unmerge: stringify Atom before str operations

Atom is no longer a str subclass, but _unmerge_display() still indexed
and concatenated candidate_catpkgs entries directly, which crashed with

    TypeError: 'Atom' object is not subscriptable

when the operator-prefix check ran (i.e. whenever the initial match
failed). Take str() up front like the loop above does, and use it for
the operator check, the ambiguous-name message, and the "Couldn't find"
message.

Bug: https://bugs.gentoo.org/980394
Fixes: 7e15fc7fa ("dep: Atom: remove str subtyping")
Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 lib/_emerge/unmerge.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/_emerge/unmerge.py b/lib/_emerge/unmerge.py
index 41daaff7a..e8a31b7c5 100644
--- a/lib/_emerge/unmerge.py
+++ b/lib/_emerge/unmerge.py
@@ -208,12 +208,13 @@ def _unmerge_display(
         for x in candidate_catpkgs:
             # cycle through all our candidate deps and determine
             # what will and will not get unmerged
+            x_str = str(x)  # this could be an Atom, stringify
             try:
                 mymatch = vartree.dbapi.match(x)
             except portage.exception.AmbiguousPackageName as errpkgs:
                 print(
                     '\n\n!!! The short ebuild name "'
-                    + x
+                    + x_str
                     + '" is ambiguous.  Please specify'
                 )
                 print(
@@ -225,11 +226,11 @@ def _unmerge_display(
                 print()
                 sys.exit(1)
 
-            if not mymatch and x[0] not in "<>=~":
+            if not mymatch and x_str[0] not in "<>=~":
                 mymatch = vartree.dep_match(x)
             if not mymatch:
                 portage.writemsg(
-                    f"\n--- Couldn't find '{str(x).replace('null/', '')}' to {unmerge_action}.\n",
+                    f"\n--- Couldn't find '{x_str.replace('null/', '')}' to {unmerge_action}.\n",
                     noiselevel=-1,
                 )
                 continue
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.