New submission from Sergei Lebedev <superbo...@gmail.com>: 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? ---------- components: Library (Lib) messages: 140330 nosy: superbobry priority: normal severity: normal status: open title: Disable size checks in mmap.mmap() type: feature request versions: Python 2.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue12556> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com