[issue32798] mmap.flush() on Linux does not accept the "offset" and "size" args

2018-02-08 Thread Byron Hawkins

New submission from Byron Hawkins :

open_file = open("file.txt", "r+b")
file_map = mmap.mmap(open_file, 0)
file_map.seek(offset)
file_map.write("foobar") # success
file_map.flush() # success
file_map.flush(offset, len("foobar")) # Fails with "errno 22"

This example passes correct arguments to mmap.flush(), yet it fails with errno 
22. So the arguments are not valid on linux. If the bug cannot be fixed, then 
all reference to those two arguments should be removed from the code and 
documentation related to Linux.

--
components: Library (Lib)
messages: 311832
nosy: byronhawkins
priority: normal
severity: normal
status: open
title: mmap.flush() on Linux does not accept the "offset" and "size" args
type: crash
versions: Python 2.7

___
Python tracker 
<https://bugs.python.org/issue32798>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32798] mmap.flush() on Linux does not accept the "offset" and "size" args

2018-02-08 Thread Byron Hawkins

Byron Hawkins  added the comment:

Couldn't the implementation check the page size and throw a better error (for 
relevant platforms)? Or better yet, adjust the offset to the nearest inclusive 
page boundary.

--

___
Python tracker 
<https://bugs.python.org/issue32798>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com