Kaydet (Commit) 1db37f32 authored tarafından Ross Lagerwall's avatar Ross Lagerwall

Merge with 3.2 (Issue #12404).

...@@ -200,6 +200,9 @@ Core and Builtins ...@@ -200,6 +200,9 @@ Core and Builtins
Library 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 - Issue #1874: email now detects and reports as a defect the presence of
any CTE other than 7bit, 8bit, or binary on a multipart. any CTE other than 7bit, 8bit, or binary on a multipart.
......
...@@ -1162,12 +1162,13 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict) ...@@ -1162,12 +1162,13 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict)
# endif # endif
if (fd != -1 && fstat(fd, &st) == 0 && S_ISREG(st.st_mode)) { if (fd != -1 && fstat(fd, &st) == 0 && S_ISREG(st.st_mode)) {
if (map_size == 0) { if (map_size == 0) {
off_t calc_size;
if (offset >= st.st_size) { if (offset >= st.st_size) {
PyErr_SetString(PyExc_ValueError, PyErr_SetString(PyExc_ValueError,
"mmap offset is greater than file size"); "mmap offset is greater than file size");
return NULL; return NULL;
} }
off_t calc_size = st.st_size - offset; calc_size = st.st_size - offset;
map_size = calc_size; map_size = calc_size;
if (map_size != calc_size) { if (map_size != calc_size) {
PyErr_SetString(PyExc_ValueError, PyErr_SetString(PyExc_ValueError,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment