]> granicus.if.org Git - python/commitdiff
Issue #22396: On 32-bit AIX platform, don't expose os.posix_fadvise() nor
authorVictor Stinner <victor.stinner@gmail.com>
Tue, 30 Sep 2014 10:20:05 +0000 (12:20 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Tue, 30 Sep 2014 10:20:05 +0000 (12:20 +0200)
os.posix_fallocate() because their prototypes in system headers are wrong.

Misc/NEWS
Modules/posixmodule.c

index a1fc5d0d15170780d36ea74613d173ce07efefaf..ba25316a9e64bc89891b3f3a1234c806e8167a7f 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -19,6 +19,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #22396: On 32-bit AIX platform, don't expose os.posix_fadvise() nor
+  os.posix_fallocate() because their prototypes in system headers are wrong.
+
 - Issue #22517: When a io.BufferedRWPair object is deallocated, clear its
   weakrefs.
 
index 8cd5485cebc4bc4579fa72a0698894328174f3d4..8bea76ecccc828c1844939efb5cdfa269398828b 100644 (file)
@@ -8786,7 +8786,15 @@ posix_truncate(PyObject *self, PyObject *args, PyObject *kwargs)
 }
 #endif
 
-#ifdef HAVE_POSIX_FALLOCATE
+/* 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)
 PyDoc_STRVAR(posix_posix_fallocate__doc__,
 "posix_fallocate(fd, offset, len)\n\n\
 Ensures that enough disk space is allocated for the file specified by fd\n\
@@ -8813,7 +8821,7 @@ posix_posix_fallocate(PyObject *self, PyObject *args)
 }
 #endif
 
-#ifdef HAVE_POSIX_FADVISE
+#if defined(HAVE_POSIX_FADVISE) && !defined(POSIX_FADVISE_AIX_BUG)
 PyDoc_STRVAR(posix_posix_fadvise__doc__,
 "posix_fadvise(fd, offset, len, advice)\n\n\
 Announces an intention to access data in a specific pattern thus allowing\n\
@@ -11485,10 +11493,10 @@ static PyMethodDef posix_methods[] = {
                         METH_VARARGS | METH_KEYWORDS,
                         posix_truncate__doc__},
 #endif
-#ifdef HAVE_POSIX_FALLOCATE
+#if defined(HAVE_POSIX_FALLOCATE) && !defined(POSIX_FADVISE_AIX_BUG)
     {"posix_fallocate", posix_posix_fallocate, METH_VARARGS, posix_posix_fallocate__doc__},
 #endif
-#ifdef HAVE_POSIX_FADVISE
+#if defined(HAVE_POSIX_FADVISE) && !defined(POSIX_FADVISE_AIX_BUG)
     {"posix_fadvise",   posix_posix_fadvise, METH_VARARGS, posix_posix_fadvise__doc__},
 #endif
 #ifdef HAVE_PUTENV