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 superbobry
Recipients superbobry
Date 2011-07-14.13:20:59
SpamBayes Score 1.1531768e-08
Marked as misclassified No
Message-id <1310649660.01.0.028468381149.issue12556@psf.upfronthosting.co.za>
In-reply-to
Content
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?
History
Date User Action Args
2011-07-14 13:21:00superbobrysetrecipients: + superbobry
2011-07-14 13:21:00superbobrysetmessageid: <1310649660.01.0.028468381149.issue12556@psf.upfronthosting.co.za>
2011-07-14 13:20:59superbobrylinkissue12556 messages
2011-07-14 13:20:59superbobrycreate