Hirokazu Yamamoto <ocean-c...@m2.ccsnet.ne.jp> added the comment: I reconsidered this issue. When mmap is anonymous, self->file_handle == INVALID_HANDLE_VALUE (-1), so we should not call SetFilePointer and SetEndOfFile for this handle.
And the behavior of mmap.resize is not documented clearly though, current behavior for anonymous mapping object is different from one for file mapping object. >>> import mmap >>> m1 = mmap.mmap(-1, 10, tagname="foo") >>> m2 = mmap.mmap(-1, 10, tagname="foo") >>> for i in xrange(10): ... m1[i] = str(i) ... >>> m1[:] '0123456789' >>> m2[:] '0123456789' >>> m2.resize(5) >>> m1[:] '0123456789' >>> m2[:] '01234' For file mapping object, mmap.resize() resizes underlying file too, but for anonymous mapping object, doesn't resize memory region itself. I cannot find the Win32API to resize memory region created by CreateFileMapping. I'm not sure this difference is intended by mmap module writer. Maybe is_resizeable(mmap_object *self) should return 0 for anonymous mapping object on windows. (Of course, such difference might be acceptable because mmap.size() already have such difference) _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue2733> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com