New submission from Amaury Forgeot d'Arc <[email protected]>:
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 <[email protected]>
<http://bugs.python.org/issue6344>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com