diff --git a/Misc/NEWS b/Misc/NEWS index 4e4b47c7c06..6786cad716a 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -200,6 +200,9 @@ Core and Builtins Library ------- +- Issue #12404: Remove C89 incompatible code from mmap module. Patch by Akira + Kitada. + - Issue #1874: email now detects and reports as a defect the presence of any CTE other than 7bit, 8bit, or binary on a multipart. diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index ab12e2c54c5..5d086a7386a 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c @@ -1162,12 +1162,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,