Message136217
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. |
|
Date |
User |
Action |
Args |
2011-05-18 09:56:04 | rion4ik@gmail.com | set | recipients:
+ rion4ik@gmail.com |
2011-05-18 09:56:04 | rion4ik@gmail.com | set | messageid: <1305712564.35.0.453001267253.issue12102@psf.upfronthosting.co.za> |
2011-05-18 09:56:03 | rion4ik@gmail.com | link | issue12102 messages |
2011-05-18 09:56:03 | rion4ik@gmail.com | create | |
|