[issue40720] accessing mmap of file that is overwritten causes bus error

2021-10-18 Thread Irit Katriel
Irit Katriel added the comment: Reproduced on 3.11. -- nosy: +iritkatriel versions: +Python 3.11 -Python 3.6, Python 3.7, Python 3.8 ___ Python tracker ___

[issue40720] accessing mmap of file that is overwritten causes bus error

2021-03-09 Thread Ronald Oussoren
Ronald Oussoren added the comment: What happens here is that the file is truncated, which (more or less) truncates the memory mapping. Accessing a memory mapping beyond the length of the file results in a SIGBUS signal. I'm not sure if there is much Python can do about this other than

[issue40720] accessing mmap of file that is overwritten causes bus error

2021-03-09 Thread Thomas Grainger
Thomas Grainger added the comment: I can confirm this happens on py3.5-3.10 ``` import mmap import pathlib import tempfile def main(): with tempfile.TemporaryDirectory() as tmp: tmp_path = pathlib.Path(tmp) path = tmp_path / "eg" path.write_bytes(b"Hello,

[issue40720] accessing mmap of file that is overwritten causes bus error

2020-05-22 Thread Marten H. van Kerkwijk
Marten H. van Kerkwijk added the comment: I should probably have added that the bus error happens on linux. On Windows, the opening of the file for writing leads to an error, as the file is still opened for reading inside the mmap. -- ___ Python

[issue40720] accessing mmap of file that is overwritten causes bus error

2020-05-21 Thread Marten H. van Kerkwijk
New submission from Marten H. van Kerkwijk : While debugging a strange failure with tests and np.memmap, I realized that the following direct use of mmap reliably leads to a bus error. Here, obviously mmap'ing a file, closing it, opening the file for writing but not writing anything, and