Skip to content

Commit 90e2451

Browse files
autoimport/sqlite.py: python3.13 iterdir() raises PermissionError
The PermissionError is now raised earlier when we initialize the iterdir object instead of when we attempt to get the next() Closes: #801 Signed-off-by: Nowa Ammerlaan <nowa@gentoo.org>
1 parent 8bb4ac0 commit 90e2451

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

rope/contrib/autoimport/sqlite.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -569,14 +569,17 @@ def filter_folders(folder: Path) -> bool:
569569
return list(OrderedDict.fromkeys(folder_paths))
570570

571571
def _safe_iterdir(self, folder: Path):
572-
dirs = folder.iterdir()
573-
while True:
574-
try:
575-
yield next(dirs)
576-
except PermissionError:
577-
pass
578-
except StopIteration:
579-
break
572+
try:
573+
dirs = folder.iterdir()
574+
while True:
575+
try:
576+
yield next(dirs)
577+
except PermissionError:
578+
pass
579+
except StopIteration:
580+
break
581+
except PermissionError:
582+
pass
580583

581584
def _get_available_packages(self) -> List[Package]:
582585
packages: List[Package] = [

0 commit comments

Comments
 (0)