[New-bugs-announce] [issue6344] mmap.read() crashes when passed a negative argument
Amaury Forgeot d'Arc
report at bugs.python.org
Thu Jun 25 23:22:28 CEST 2009
New submission from Amaury Forgeot d'Arc <amauryfa at gmail.com>:
mmap.read() crashes when passed a negative count:
def test_read_negative(self):
f = open(TESTFN, 'w+')
f.write("ABCDE\0abcde")
f.flush()
mf = mmap.mmap(f.fileno(), 0)
self.assertEqual(mf.read(2), "AB") # OK
self.assertEqual(mf.read(-1), "CDE") # ??
self.assertEqual(mf.read(-1), "BCDE") # ??
self.assertEqual(mf.read(-1), "ABCDE") # ??
mf.read(-1) # crash!!
I don't know what mf.read(-1) should do: raise a ValueError, return the empty
string, or return everything from the current pos to len(mf)?
----------
components: Library (Lib)
messages: 89714
nosy: amaury.forgeotdarc, ocean-city
priority: high
severity: normal
status: open
title: mmap.read() crashes when passed a negative argument
type: crash
versions: Python 2.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6344>
_______________________________________
More information about the New-bugs-announce
mailing list