From 4881d1aa88aa40a25900e4530fb56c6054b19f16 Mon Sep 17 00:00:00 2001 From: Batuhan Taskaya Date: Tue, 7 Apr 2020 05:10:11 +0300 Subject: [PATCH 1/2] bpo-40212: Re-enable posix_fadvise and f_allocate on AIX --- .../2020-04-07-05-09-34.bpo-40212.oPYeBs.rst | 1 + Modules/posixmodule.c | 18 ++++-------------- 2 files changed, 5 insertions(+), 14 deletions(-) create mode 100644 Misc/NEWS.d/next/Library/2020-04-07-05-09-34.bpo-40212.oPYeBs.rst 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/posixmodule.c b/Modules/posixmodule.c index 345798dc8c10de..46ce7659b6ee3f 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -10089,16 +10089,7 @@ 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 - - -#if defined(HAVE_POSIX_FALLOCATE) && !defined(POSIX_FADVISE_AIX_BUG) +#if defined(HAVE_POSIX_FALLOCATE) /*[clinic input] os.posix_fallocate @@ -10136,10 +10127,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 */ +#endif /* HAVE_POSIX_FALLOCATE */ -#if defined(HAVE_POSIX_FADVISE) && !defined(POSIX_FADVISE_AIX_BUG) +#if defined(HAVE_POSIX_FADVISE) /*[clinic input] os.posix_fadvise @@ -10183,8 +10174,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 static PyObject* From 5ea5dc1b810c34fe4da014ade420bf360476f7e1 Mon Sep 17 00:00:00 2001 From: Batuhan Taskaya Date: Tue, 7 Apr 2020 05:24:25 +0300 Subject: [PATCH 2/2] Regenerate clinic header --- Modules/clinic/posixmodule.c.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h index 8ff06feb12ec6d..99daad858f67c7 100644 --- a/Modules/clinic/posixmodule.c.h +++ b/Modules/clinic/posixmodule.c.h @@ -5915,7 +5915,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)) +#if defined(HAVE_POSIX_FALLOCATE) PyDoc_STRVAR(os_posix_fallocate__doc__, "posix_fallocate($module, fd, offset, length, /)\n" @@ -5965,9 +5965,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)) */ +#endif /* defined(HAVE_POSIX_FALLOCATE) */ -#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" @@ -6032,7 +6032,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) @@ -8869,4 +8869,4 @@ os_waitstatus_to_exitcode(PyObject *module, PyObject *const *args, Py_ssize_t na #ifndef OS_WAITSTATUS_TO_EXITCODE_METHODDEF #define OS_WAITSTATUS_TO_EXITCODE_METHODDEF #endif /* !defined(OS_WAITSTATUS_TO_EXITCODE_METHODDEF) */ -/*[clinic end generated code: output=4e28994a729eddf9 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=90c6fcd822ca8358 input=a9049054013a1b77]*/