Message136217
| Author |
rion4ik@gmail.com |
| Recipients |
rion4ik@gmail.com |
| Date |
2011年05月18日.09:56:03 |
| SpamBayes Score |
1.9555952e-08 |
| Marked as misclassified |
No |
| Message-id |
<1305712564.35.0.453001267253.issue12102@psf.upfronthosting.co.za> |
| 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 | 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 |
|