Paul <paul.carli...@gmail.com> added the comment:
I've dug into stracing this python program in 2.7 vs. 3.7. directread.py import mmap import os fd = os.open('/dev/dm-2', os.O_DIRECT | os.O_RDWR) # mapped block device fo = os.fdopen(fd, 'rb+') m = mmap.mmap(-1, 4096) fo.readinto(m) Python 2.7 result: ... open("/dev/dm-2", O_RDWR|O_DIRECT) = 3 ... mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, -1, 0) = 0x7f743db31000 ... read(0x3, 0x7f743db31000, 0x1000) = 0x1000 ... Python 3.7 result: ... open("/dev/dm-2", O_RDWR|O_DIRECT|O_CLOEXEC) = 3 ... mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, -1, 0) = 0x7f5e087ee000 ... read(0x3, 0x256c8a0, 0x1000) = -1 (errno 22) Notice that Python 3 isn't using the mmap buffer for the read. Why is it using a stack buffer? ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue5396> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com