]> granicus.if.org Git - python/commitdiff
Issue 12404: Remove C89 incompatible code from mmap module.
authorRoss Lagerwall <rosslagerwall@gmail.com>
Sat, 25 Jun 2011 07:55:10 +0000 (09:55 +0200)
committerRoss Lagerwall <rosslagerwall@gmail.com>
Sat, 25 Jun 2011 07:55:10 +0000 (09:55 +0200)
Patch by Akira Kitada.

Misc/NEWS
Modules/mmapmodule.c

index 2e33e7f5b801d920203eda6b185e59349ce3d05e..bddddfa29cdf573deba351eff3cd8666feb898db 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -16,6 +16,9 @@ Core and Builtins
 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.
 
index 3078279f22346397dbec0cdfdb79d0092ed9056b..a5027f51e2c0323148ffc4872709a38cd9eaff94 100644 (file)
@@ -1188,12 +1188,13 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict)
 #  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,