Skip to content

Commit 97c4c06

Browse files
authored
GH-111804: Drop posix.fallocate() under WASI (GH-111869)
Drop posix.fallocate() under WASI. The underlying POSIX function, posix_fallocate(), was found to vary too much between implementations to remain in WASI. As such, while it was available in WASI preview1, it's been dropped in preview2.
1 parent 31c90d5 commit 97c4c06

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Remove posix.fallocate() under WASI as the underlying posix_fallocate() is
2+
not available in WASI preview2.

Modules/clinic/posixmodule.c.h

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/posixmodule.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12165,7 +12165,10 @@ os_truncate_impl(PyObject *module, path_t *path, Py_off_t length)
1216512165
#endif
1216612166

1216712167

12168-
#if defined(HAVE_POSIX_FALLOCATE) && !defined(POSIX_FADVISE_AIX_BUG)
12168+
/* GH-111804: Due to posix_fallocate() not having consistent semantics across
12169+
OSs, support was dropped in WASI preview2. */
12170+
#if defined(HAVE_POSIX_FALLOCATE) && !defined(POSIX_FADVISE_AIX_BUG) && \
12171+
!defined(__wasi__)
1216912172
/*[clinic input]
1217012173
os.posix_fallocate
1217112174
@@ -12203,7 +12206,7 @@ os_posix_fallocate_impl(PyObject *module, int fd, Py_off_t offset,
1220312206
errno = result;
1220412207
return posix_error();
1220512208
}
12206-
#endif /* HAVE_POSIX_FALLOCATE) && !POSIX_FADVISE_AIX_BUG */
12209+
#endif /* HAVE_POSIX_FALLOCATE) && !POSIX_FADVISE_AIX_BUG && !defined(__wasi__) */
1220712210

1220812211

1220912212
#if defined(HAVE_POSIX_FADVISE) && !defined(POSIX_FADVISE_AIX_BUG)

0 commit comments

Comments
 (0)