Skip to content

Commit 779f59e

Browse files
authored
Separate match resolution from recursive join.
1 parent abfef1d commit 779f59e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

importlib_resources/abc.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,12 @@ def joinpath(self, *descendants: StrPath) -> "Traversable":
116116
traversable for traversable in self.iterdir() if traversable.name == target
117117
)
118118
try:
119-
return next(matches).joinpath(*names)
119+
match = next(matches)
120120
except StopIteration:
121121
raise TraversalError(
122122
"Target not found during traversal.", target, list(names)
123123
)
124+
return match.joinpath(*names)
124125

125126
def __truediv__(self, child: StrPath) -> "Traversable":
126127
"""

0 commit comments

Comments
 (0)