Skip to content

Commit be2908a

Browse files
author
Samuel FORESTIER
committed
Prefers a set for seen_paths collection
1 parent 7bcab19 commit be2908a

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/distro/distro.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,7 +1108,7 @@ def __resolve_chroot_symlink_as_needed(self, link_location: str) -> str:
11081108
if os.path.commonprefix([self.root_dir, link_location]) != self.root_dir:
11091109
raise FileNotFoundError
11101110

1111-
seen_paths = []
1111+
seen_paths = set()
11121112
while True:
11131113
try:
11141114
resolved = os.readlink(link_location)
@@ -1136,7 +1136,7 @@ def __resolve_chroot_symlink_as_needed(self, link_location: str) -> str:
11361136
if resolved in seen_paths:
11371137
raise OSError(errno.ELOOP, os.strerror(errno.ELOOP), resolved)
11381138

1139-
seen_paths.append(link_location)
1139+
seen_paths.add(link_location)
11401140
link_location = resolved
11411141

11421142
@cached_property

0 commit comments

Comments
 (0)