Closes #15676: mmap: add empty file check prior to offset check
diff --git a/Lib/test/test_mmap.py b/Lib/test/test_mmap.py
index 0e18aab..c060e61 100644
--- a/Lib/test/test_mmap.py
+++ b/Lib/test/test_mmap.py
@@ -459,6 +459,15 @@
         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')