stack_lists: optimize repo handling more
diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py
index e8b60fb..4db3349 100644
--- a/pym/portage/util/__init__.py
+++ b/pym/portage/util/__init__.py
@@ -272,7 +272,14 @@
to_be_removed = []
token_slice = token[1:]
for atom in new_list:
- if atom.without_repo == token_slice:
+ atom_without_repo = atom
+ if atom.repo is not None:
+ # Atom.without_repo instantiates a new Atom,
+ # which is unnecessary here, so use string
+ # replacement instead.
+ atom_without_repo = \
+ atom.replace("::" + atom.repo, "", 1)
+ if atom_without_repo == token_slice:
to_be_removed.append(atom)
if to_be_removed:
matched = True