Skip to content

Commit

Permalink
fix: Prevent infinite loop while looking for package's parent folder
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed Nov 12, 2022
1 parent 267bede commit f297f1a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/griffe/finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def _top_module_name(self, path: Path) -> str:
return top_path.name
# if not, get the highest directory with an __init__ module,
# add its parent to search paths and return it
while (parent_path.parent / "__init__.py").exists():
while parent_path.parent != parent_path and (parent_path.parent / "__init__.py").exists():
parent_path = parent_path.parent
self.search_paths.insert(0, parent_path.parent)
return parent_path.name
Expand Down

0 comments on commit f297f1a

Please sign in to comment.