Skip to content

Commit 8aff8be

Browse files
committed
Reformat code in fs.osfs and add entry to CHANGELOG.md
1 parent ea75f07 commit 8aff8be

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
4040
- `WrapCachedDir.isdir` and `WrapCachedDir.isfile` raising a `ResourceNotFound` error on non-existing path ([#470](https://github.com/PyFilesystem/pyfilesystem2/pull/470)).
4141
- `FTPFS` not listing certain entries with sticky/SUID/SGID permissions set by Linux server ([#473](https://github.com/PyFilesystem/pyfilesystem2/pull/473)).
4242
Closes [#451](https://github.com/PyFilesystem/pyfilesystem2/issues/451).
43+
- `scandir` iterator not being closed explicitly in `OSFS.scandir`, occasionally causing a `ResourceWarning`
44+
to be thrown. Closes [#311](https://github.com/PyFilesystem/pyfilesystem2/issues/311).
4345

4446

4547
## [2.4.12] - 2021-01-14

fs/osfs.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,15 +496,19 @@ def _scandir(self, path, namespaces=None):
496496
if requires_stat:
497497
stat_result = dir_entry.stat()
498498
if "details" in namespaces:
499-
info["details"] = self._make_details_from_stat(stat_result)
499+
info["details"] = self._make_details_from_stat(
500+
stat_result
501+
)
500502
if "stat" in namespaces:
501503
info["stat"] = {
502504
k: getattr(stat_result, k)
503505
for k in dir(stat_result)
504506
if k.startswith("st_")
505507
}
506508
if "access" in namespaces:
507-
info["access"] = self._make_access_from_stat(stat_result)
509+
info["access"] = self._make_access_from_stat(
510+
stat_result
511+
)
508512
if "lstat" in namespaces:
509513
lstat_result = dir_entry.stat(follow_symlinks=False)
510514
info["lstat"] = {

0 commit comments

Comments
 (0)