This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ocean-city
Recipients amaury.forgeotdarc, kmk, ocean-city, tim.golden, trent
Date 2009-02-18.15:25:07
SpamBayes Score 1.494966e-07
Marked as misclassified No
Message-id <1234970710.49.0.675170622816.issue2733@psf.upfronthosting.co.za>
In-reply-to
Content
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)
History
Date User Action Args
2009-02-18 15:25:11ocean-citysetrecipients: + ocean-city, amaury.forgeotdarc, tim.golden, kmk, trent
2009-02-18 15:25:10ocean-citysetmessageid: <1234970710.49.0.675170622816.issue2733@psf.upfronthosting.co.za>
2009-02-18 15:25:09ocean-citylinkissue2733 messages
2009-02-18 15:25:07ocean-citycreate