Skip to content

Commit

Permalink
Fix __all__ on win32 (#174)
Browse files Browse the repository at this point in the history
* Fix __all__ on win32

`sendfile` and `statvfs` are only defined when they are defined
in the `os` module, i.e. not on win32. But they were added to
`__all__` unconditionally.

* Add a changelog entry
  • Loading branch information
srittau committed Aug 15, 2023
1 parent 6bfcaae commit 1456aa9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ async def test_stuff():

### History

#### 23.2.2 (UNRELEASED)

- Remove spurious items from `aiofiles.os.__all__` when running on Windows.

#### 23.2.1 (2023-08-09)

- Import `os.statvfs` conditionally to fix importing on non-UNIX systems.
Expand Down
6 changes: 4 additions & 2 deletions src/aiofiles/os.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
__all__ = [
"path",
"stat",
"statvfs",
"rename",
"renames",
"replace",
Expand All @@ -23,9 +22,12 @@
"listdir",
"scandir",
"access",
"sendfile",
"wrap",
]
if hasattr(os, "sendfile"):
__all__ += ["sendfile"]
if hasattr(os, "statvfs"):
__all__ += ["statvfs"]


stat = wrap(os.stat)
Expand Down

0 comments on commit 1456aa9

Please sign in to comment.