mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Closes #15676: mmap: add empty file check prior to offset check
This commit is contained in:
commit
1b3f3b0316
3 changed files with 17 additions and 0 deletions
|
@ -488,6 +488,15 @@ class MmapTests(unittest.TestCase):
|
|||
f.flush ()
|
||||
return mmap.mmap (f.fileno(), 0)
|
||||
|
||||
def test_empty_file (self):
|
||||
f = open (TESTFN, 'w+b')
|
||||
f.close()
|
||||
f = open(TESTFN, "rb")
|
||||
self.assertRaisesRegex(ValueError,
|
||||
"cannot mmap an empty file",
|
||||
mmap.mmap, f.fileno(), 0, access=mmap.ACCESS_READ)
|
||||
f.close()
|
||||
|
||||
def test_offset (self):
|
||||
f = open (TESTFN, 'w+b')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue