Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0d9f9dc

Browse files
committed
Windows mmap should (as the docs probably <wink> say) create a mapping
without a name when the optional tagname arg isn't specified. Was actually creating a mapping with an empty string as the name.
1 parent fe338ca commit 0d9f9dc

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Modules/mmapmodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,7 @@ new_mmap_object(PyObject *self, PyObject *args)
907907
m_obj->pos = (size_t) 0;
908908

909909
/* set the tag name */
910-
if (tagname != NULL) {
910+
if (tagname != NULL && *tagname != '\0') {
911911
m_obj->tagname = PyMem_Malloc(strlen(tagname)+1);
912912
if (m_obj->tagname == NULL) {
913913
PyErr_NoMemory();
@@ -924,7 +924,7 @@ new_mmap_object(PyObject *self, PyObject *args)
924924
PAGE_READWRITE,
925925
0,
926926
m_obj->size,
927-
tagname);
927+
m_obj->tagname);
928928
if (m_obj->map_handle != NULL) {
929929
m_obj->data = (char *) MapViewOfFile (m_obj->map_handle,
930930
FILE_MAP_WRITE,

0 commit comments

Comments
 (0)