summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2023-11-09 23:35:51 (GMT)
committerGitHub <noreply@github.com>2023-11-09 23:35:51 (GMT)
commit5a8e6f8bccd7048e592f6bd45af503ce3fac95dd (patch)
tree612cb965b7539c4493be28c65b8dfbb302428c51
parent09df271965b5af6beeaa6a2d17a2c5a145fc5201 (diff)
downloadcpython-5a8e6f8bccd7048e592f6bd45af503ce3fac95dd.zip
cpython-5a8e6f8bccd7048e592f6bd45af503ce3fac95dd.tar.gz
cpython-5a8e6f8bccd7048e592f6bd45af503ce3fac95dd.tar.bz2
[3.12] GH-111804: Drop posix.fallocate() under WASI (GH-111869) (GH-111919)
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.
-rw-r--r--Misc/NEWS.d/next/Library/2023-11-08-15-58-57.gh-issue-111804.uAXTOL.rst2
-rw-r--r--Modules/clinic/posixmodule.c.h6
-rw-r--r--Modules/posixmodule.c7
3 files changed, 10 insertions, 5 deletions
diff --git a/Misc/NEWS.d/next/Library/2023-11-08-15-58-57.gh-issue-111804.uAXTOL.rst b/Misc/NEWS.d/next/Library/2023-11-08-15-58-57.gh-issue-111804.uAXTOL.rst
new file mode 100644
index 0000000..2696f2f
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2023-11-08-15-58-57.gh-issue-111804.uAXTOL.rst
@@ -0,0 +1,2 @@
+Remove posix.fallocate() under WASI as the underlying posix_fallocate() is
+not available in WASI preview2.
diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h
index fb01c8d..3e6d429 100644
--- a/Modules/clinic/posixmodule.c.h
+++ b/Modules/clinic/posixmodule.c.h
@@ -8159,7 +8159,7 @@ exit:
#endif /* (defined HAVE_TRUNCATE || defined MS_WINDOWS) */
-#if (defined(HAVE_POSIX_FALLOCATE) && !defined(POSIX_FADVISE_AIX_BUG))
+#if (defined(HAVE_POSIX_FALLOCATE) && !defined(POSIX_FADVISE_AIX_BUG) && !defined(__wasi__))
PyDoc_STRVAR(os_posix_fallocate__doc__,
"posix_fallocate($module, fd, offset, length, /)\n"
@@ -8204,7 +8204,7 @@ exit:
return return_value;
}
-#endif /* (defined(HAVE_POSIX_FALLOCATE) && !defined(POSIX_FADVISE_AIX_BUG)) */
+#endif /* (defined(HAVE_POSIX_FALLOCATE) && !defined(POSIX_FADVISE_AIX_BUG) && !defined(__wasi__)) */
#if (defined(HAVE_POSIX_FADVISE) && !defined(POSIX_FADVISE_AIX_BUG))
@@ -11999,4 +11999,4 @@ exit:
#ifndef OS_WAITSTATUS_TO_EXITCODE_METHODDEF
#define OS_WAITSTATUS_TO_EXITCODE_METHODDEF
#endif /* !defined(OS_WAITSTATUS_TO_EXITCODE_METHODDEF) */
-/*[clinic end generated code: output=ce77253f8879f36e input=a9049054013a1b77]*/
+/*[clinic end generated code: output=fa29739d72cfc07e input=a9049054013a1b77]*/
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 265c817..a98841f 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -11891,7 +11891,10 @@ os_truncate_impl(PyObject *module, path_t *path, Py_off_t length)
#endif
-#if defined(HAVE_POSIX_FALLOCATE) && !defined(POSIX_FADVISE_AIX_BUG)
+/* GH-111804: Due to posix_fallocate() not having consistent semantics across
+ OSs, support was dropped in WASI preview2. */
+#if defined(HAVE_POSIX_FALLOCATE) && !defined(POSIX_FADVISE_AIX_BUG) && \
+ !defined(__wasi__)
/*[clinic input]
os.posix_fallocate
@@ -11929,7 +11932,7 @@ os_posix_fallocate_impl(PyObject *module, int fd, Py_off_t offset,
errno = result;
return posix_error();
}
-#endif /* HAVE_POSIX_FALLOCATE) && !POSIX_FADVISE_AIX_BUG */
+#endif /* HAVE_POSIX_FALLOCATE) && !POSIX_FADVISE_AIX_BUG && !defined(__wasi__) */
#if defined(HAVE_POSIX_FADVISE) && !defined(POSIX_FADVISE_AIX_BUG)