[Python-checkins] cpython (3.4): Issue #22396: On 32-bit AIX platform, don't expose os.posix_fadvise() nor

victor.stinner python-checkins at python.org
Tue Sep 30 12:36:16 CEST 2014


https://hg.python.org/cpython/rev/8e5e19b3cd4e
changeset:   92652:8e5e19b3cd4e
branch:      3.4
parent:      92649:6f54dfa675eb
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Tue Sep 30 12:20:05 2014 +0200
summary:
  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.

files:
  Misc/NEWS             |   3 +++
  Modules/posixmodule.c |  16 ++++++++++++----
  2 files changed, 15 insertions(+), 4 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -19,6 +19,9 @@
 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.
 
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -8786,7 +8786,15 @@
 }
 #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 @@
 }
 #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 @@
                         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

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list