mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
#15676: mmap: add empty file check prior to offset check <- Previous patch was incomplete
This commit is contained in:
parent
3159cb51a7
commit
1f2799bef4
2 changed files with 10 additions and 5 deletions
|
@ -462,11 +462,11 @@ class MmapTests(unittest.TestCase):
|
|||
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()
|
||||
with open(TESTFN, "rb") as f :
|
||||
self.assertRaisesRegex(ValueError,
|
||||
"cannot mmap an empty file",
|
||||
mmap.mmap, f.fileno(), 0,
|
||||
access=mmap.ACCESS_READ)
|
||||
|
||||
def test_offset (self):
|
||||
f = open (TESTFN, 'w+b')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue