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.

classification
Title: mmap crash on Windows
Type: crash Stage: resolved
Components: Interpreter Core, Windows Versions: Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: VUIUI, amaury.forgeotdarc, itabhijitb, sbt, vstinner
Priority: normal Keywords:

Created on 2011-09-02 05:17 by itabhijitb, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (4)
msg143378 - (view) Author: Abhijit Bhattacharjee (itabhijitb) Date: 2011-09-02 05:17
The following Code causes Python to crash
import os
import mmap
data = mmap.mmap(open(<Certain File>,"r+").fileno(),os.path.getsize(<Certain File>))

assuming <Certain File> is present in the current working directory
msg143395 - (view) Author: Richard Oudkerk (sbt) * (Python committer) Date: 2011-09-02 11:10
You are not doing anything to stop the file object being garbage collected (and therefore closed) before the mmap is created.  Try

import os
import mmap
f = open(<Certain File>,"r+")
size = os.path.getsize(<Certain File>))
data = mmap.mmap(f.fileno(), size)
msg143408 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2011-09-02 16:07
Is it a crash, or do you get a exception with a nice message?
msg161578 - (view) Author: Richard Oudkerk (sbt) * (Python committer) Date: 2012-05-25 12:18
Without more information I will close this.
History
Date User Action Args
2022-04-11 14:57:21adminsetgithub: 57091
2012-06-19 13:36:14sbtsetstatus: pending -> closed
2012-05-25 12:18:18sbtsetstatus: open -> pending
resolution: not a bug
messages: + msg161578

stage: resolved
2011-09-02 16:07:42amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg143408
2011-09-02 13:49:24neologixsetmessages: - msg143397
2011-09-02 13:43:03VUIUIsetnosy: + VUIUI
messages: + msg143397
2011-09-02 11:13:56vstinnersetnosy: + vstinner
2011-09-02 11:10:08sbtsetnosy: + sbt
messages: + msg143395
2011-09-02 05:17:10itabhijitbcreate