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.

Author amaury.forgeotdarc
Recipients amaury.forgeotdarc, ocean-city
Date 2009-06-25.21:22:26
SpamBayes Score 0.0073151165
Marked as misclassified No
Message-id <1245964948.96.0.802532537301.issue6344@psf.upfronthosting.co.za>
In-reply-to
Content
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)?
History
Date User Action Args
2009-06-25 21:22:29amaury.forgeotdarcsetrecipients: + amaury.forgeotdarc, ocean-city
2009-06-25 21:22:28amaury.forgeotdarcsetmessageid: <1245964948.96.0.802532537301.issue6344@psf.upfronthosting.co.za>
2009-06-25 21:22:27amaury.forgeotdarclinkissue6344 messages
2009-06-25 21:22:27amaury.forgeotdarccreate