[Python-checkins] cpython (2.7): Issue 12404: Remove C89 incompatible code from mmap module.

ross.lagerwall python-checkins at python.org
Sat Jun 25 10:14:17 CEST 2011


http://hg.python.org/cpython/rev/c72dafb14c49
changeset:   70944:c72dafb14c49
branch:      2.7
parent:      70937:1e89444f4ebc
user:        Ross Lagerwall <rosslagerwall at gmail.com>
date:        Sat Jun 25 09:55:10 2011 +0200
summary:
  Issue 12404: Remove C89 incompatible code from mmap module.

Patch by Akira Kitada.

files:
  Misc/NEWS            |  3 +++
  Modules/mmapmodule.c |  3 ++-
  2 files changed, 5 insertions(+), 1 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -16,6 +16,9 @@
 Library
 -------
 
+- Issue #12404: Remove C89 incompatible code from mmap module. Patch by Akira
+  Kitada.
+
 - Issue #11700: mailbox proxy object close methods can now be called multiple
   times without error, and _ProxyFile now closes the wrapped file.
 
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -1188,12 +1188,13 @@
 #  endif
     if (fd != -1 && fstat(fd, &st) == 0 && S_ISREG(st.st_mode)) {
         if (map_size == 0) {
+            off_t calc_size;
             if (offset >= st.st_size) {
                 PyErr_SetString(PyExc_ValueError,
                                 "mmap offset is greater than file size");
                 return NULL;
             }
-            off_t calc_size = st.st_size - offset;
+            calc_size = st.st_size - offset;
             map_size = calc_size;
             if (map_size != calc_size) {
                 PyErr_SetString(PyExc_ValueError,

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


More information about the Python-checkins mailing list