[New-bugs-announce] [issue6271] mmap: don't close file description if fd=-1

STINNER Victor report at bugs.python.org
Fri Jun 12 12:50:30 CEST 2009


New submission from STINNER Victor <victor.stinner at haypocalc.com>:

Hi, Valgrind just told me that Python calls close(-1) on
my_mmap_object.close() for memory mappings. That's because a memory
mapping has no (related) file descriptor.

Using attached warn.py, you can see the warning using strace:

$ strace -e close python warn.py 2>&1|grep -A1 12345
close(12345)                            = -1 EBADF (Bad file descriptor)
close(4294967295)                       = -1 EBADF (Bad file descriptor)
close(12345)                            = -1 EBADF (Bad file descriptor)

where close(4294967295) means close(-1).

Attached patch fixes this warning.

----------
components: Extension Modules
files: warn.py
messages: 89269
nosy: haypo
severity: normal
status: open
title: mmap: don't close file description if fd=-1
versions: Python 2.7, Python 3.1
Added file: http://bugs.python.org/file14268/warn.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6271>
_______________________________________


More information about the New-bugs-announce mailing list