https://github.com/python/cpython/commit/f1cf762ee7d52e8acb567f1817da90ed535ef419
commit: f1cf762ee7d52e8acb567f1817da90ed535ef419
branch: main
author: Petr Viktorin <[email protected]>
committer: encukou <[email protected]>
date: 2026-02-19T15:11:21+01:00
summary:

gh-84393: Remove AIX workaround: re-enable posix_fadvise and f_allocate 
(GH-144784)

Co-authored-by: Batuhan Taskaya <[email protected]>

files:
A Misc/NEWS.d/next/Library/2020-04-07-05-09-34.bpo-40212.oPYeBs.rst
M Modules/clinic/posixmodule.c.h
M Modules/posixmodule.c

diff --git a/Misc/NEWS.d/next/Library/2020-04-07-05-09-34.bpo-40212.oPYeBs.rst 
b/Misc/NEWS.d/next/Library/2020-04-07-05-09-34.bpo-40212.oPYeBs.rst
new file mode 100644
index 00000000000000..2e9c3d81180e6a
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2020-04-07-05-09-34.bpo-40212.oPYeBs.rst
@@ -0,0 +1 @@
+Re-enable :func:`os.posix_fallocate` and :func:`os.posix_fadvise` on AIX.
diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h
index 03c0f221ba98b3..c4f498d233164c 100644
--- a/Modules/clinic/posixmodule.c.h
+++ b/Modules/clinic/posixmodule.c.h
@@ -9418,7 +9418,7 @@ os_truncate(PyObject *module, PyObject *const *args, 
Py_ssize_t nargs, PyObject
 
 #endif /* (defined HAVE_TRUNCATE || defined MS_WINDOWS) */
 
-#if (defined(HAVE_POSIX_FALLOCATE) && !defined(POSIX_FADVISE_AIX_BUG) && 
!defined(__wasi__))
+#if (defined(HAVE_POSIX_FALLOCATE) && !defined(__wasi__))
 
 PyDoc_STRVAR(os_posix_fallocate__doc__,
 "posix_fallocate($module, fd, offset, length, /)\n"
@@ -9463,9 +9463,9 @@ os_posix_fallocate(PyObject *module, PyObject *const 
*args, Py_ssize_t nargs)
     return return_value;
 }
 
-#endif /* (defined(HAVE_POSIX_FALLOCATE) && !defined(POSIX_FADVISE_AIX_BUG) && 
!defined(__wasi__)) */
+#endif /* (defined(HAVE_POSIX_FALLOCATE) && !defined(__wasi__)) */
 
-#if (defined(HAVE_POSIX_FADVISE) && !defined(POSIX_FADVISE_AIX_BUG))
+#if defined(HAVE_POSIX_FADVISE)
 
 PyDoc_STRVAR(os_posix_fadvise__doc__,
 "posix_fadvise($module, fd, offset, length, advice, /)\n"
@@ -9520,7 +9520,7 @@ os_posix_fadvise(PyObject *module, PyObject *const *args, 
Py_ssize_t nargs)
     return return_value;
 }
 
-#endif /* (defined(HAVE_POSIX_FADVISE) && !defined(POSIX_FADVISE_AIX_BUG)) */
+#endif /* defined(HAVE_POSIX_FADVISE) */
 
 #if defined(MS_WINDOWS)
 
@@ -13611,4 +13611,4 @@ os__emscripten_log(PyObject *module, PyObject *const 
*args, Py_ssize_t nargs, Py
 #ifndef OS__EMSCRIPTEN_LOG_METHODDEF
     #define OS__EMSCRIPTEN_LOG_METHODDEF
 #endif /* !defined(OS__EMSCRIPTEN_LOG_METHODDEF) */
-/*[clinic end generated code: output=5fd2aeb6ba9a5df8 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=89c21e2151ac7316 input=a9049054013a1b77]*/
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index ef90ac5de09c65..072027fa0f6174 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -13376,19 +13376,9 @@ os_truncate_impl(PyObject *module, path_t *path, 
Py_off_t length)
 #endif /* HAVE_TRUNCATE || MS_WINDOWS */
 
 
-/* Issue #22396: On 32-bit AIX platform, the prototypes of os.posix_fadvise()
-   and os.posix_fallocate() in system headers are wrong if _LARGE_FILES is
-   defined, which is the case in Python on AIX. AIX bug report:
-   http://www-01.ibm.com/support/docview.wss?uid=isg1IV56170 */
-#if defined(_AIX) && defined(_LARGE_FILES) && !defined(__64BIT__)
-#  define POSIX_FADVISE_AIX_BUG
-#endif
-
-
 /* 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__)
+#if defined(HAVE_POSIX_FALLOCATE) && !defined(__wasi__)
 /*[clinic input]
 os.posix_fallocate
 
@@ -13426,10 +13416,10 @@ 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 && 
!defined(__wasi__) */
+#endif /* HAVE_POSIX_FALLOCATE && !defined(__wasi__) */
 
 
-#if defined(HAVE_POSIX_FADVISE) && !defined(POSIX_FADVISE_AIX_BUG)
+#if defined(HAVE_POSIX_FADVISE)
 /*[clinic input]
 os.posix_fadvise
 
@@ -13473,7 +13463,7 @@ os_posix_fadvise_impl(PyObject *module, int fd, 
Py_off_t offset,
     errno = result;
     return posix_error();
 }
-#endif /* HAVE_POSIX_FADVISE && !POSIX_FADVISE_AIX_BUG */
+#endif /* HAVE_POSIX_FADVISE */
 
 
 #ifdef MS_WINDOWS

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to