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 [email protected]
Recipients [email protected]
Date 2011-05-18.09:56:03
SpamBayes Score 1.9555952e-08
Marked as misclassified No
Message-id <[email protected]>
In-reply-to
Content
Not flushed file gives next results:

rion@rionhost ~/temp $ python2 test.py 
Traceback (most recent call last):
  File "test.py", line 10, in <module>
    m = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ)
mmap.error: [Errno 22] Invalid argument
rion@rionhost ~/temp $ python3 test.py 
Traceback (most recent call last):
  File "test.py", line 10, in <module>
    m = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ)
ValueError: mmap offset is greater than file size


testcase:

import mmap
from tempfile import TemporaryFile

f = TemporaryFile()
f.write(b"hello world")

#f.flush()

m = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ)


just uncomment f.flush() and try again. feel the difference.

suggestion: force flush on file descriptor when passed to mmap.
History
Date User Action Args
2011-05-18 09:56:04[email protected]setrecipients: + [email protected]
2011-05-18 09:56:04[email protected]setmessageid: <[email protected]>
2011-05-18 09:56:03[email protected]linkissue12102 messages
2011-05-18 09:56:03[email protected]create