Skip to content

Commit 76fb2e2

Browse files
author
Samuel FORESTIER
committed
Fixes a Mypy issue and prefers comment over exception (ignored) message
1 parent 15ad8bd commit 76fb2e2

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/distro/distro.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,6 +1105,7 @@ def __resolve_chroot_symlink_as_needed(self, link_location: str) -> str:
11051105
return self.__resolve_chroot_symlink(link_location)
11061106

11071107
def __resolve_chroot_symlink(self, link_location: str) -> str:
1108+
assert self.root_dir is not None
11081109
if os.path.commonprefix([self.root_dir, link_location]) != self.root_dir:
11091110
raise FileNotFoundError
11101111

@@ -1122,9 +1123,8 @@ def __resolve_chroot_symlink(self, link_location: str) -> str:
11221123
)
11231124
!= os.path.realpath(self.root_dir)
11241125
):
1125-
raise FileNotFoundError(
1126-
f"{link_location} resolves outside of {self.root_dir}."
1127-
) from None
1126+
# `link_location` resolves outside of `self.root_dir`.
1127+
raise FileNotFoundError from None
11281128

11291129
return link_location
11301130

0 commit comments

Comments
 (0)