Message140330
Current `mmap` implementation raises a ValueError if a sum of offset and length exceeds file size, as reported by `fstat`. While perfectly valid for most use-cases, it doesn't work for "special" files, for example:
>>> with open("/proc/sys/debug/exception-trace", "r+b") as f:
... mmap.mmap(f.fileno(), 0)
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
ValueError: mmap offset is greater than file size
Same goes for almost any other /proc file, because most of them have S_ISREG() == True and st_size = 0.
How about adding a keyword argument to `mmap.mmap()`, which disables fstat-based size checks? |
|
Date |
User |
Action |
Args |
2011-07-14 13:21:00 | superbobry | set | recipients:
+ superbobry |
2011-07-14 13:21:00 | superbobry | set | messageid: <1310649660.01.0.028468381149.issue12556@psf.upfronthosting.co.za> |
2011-07-14 13:20:59 | superbobry | link | issue12556 messages |
2011-07-14 13:20:59 | superbobry | create | |
|