https://github.com/python/cpython/commit/648c44d3f7a020c7fed95d57b105738cf018a7cc
commit: 648c44d3f7a020c7fed95d57b105738cf018a7cc
branch: 3.8
author: Miss Islington (bot) <[email protected]>
committer: ambv <[email protected]>
date: 2024-01-17T15:02:24+01:00
summary:

[3.8] gh-107888: Fix test_mmap.test_access_parameter() on macOS 14 (GH-109928) 
(GH-114183)

(cherry picked from commit 9dbfe2dc8e7bba25e52f9470ae6969821a365297)

Co-authored-by: Victor Stinner <[email protected]>

files:
M Lib/test/test_mmap.py

diff --git a/Lib/test/test_mmap.py b/Lib/test/test_mmap.py
index 88c501d81a07f9..358a01d7185232 100644
--- a/Lib/test/test_mmap.py
+++ b/Lib/test/test_mmap.py
@@ -240,10 +240,15 @@ def test_access_parameter(self):
             # Try writing with PROT_EXEC and without PROT_WRITE
             prot = mmap.PROT_READ | getattr(mmap, 'PROT_EXEC', 0)
             with open(TESTFN, "r+b") as f:
-                m = mmap.mmap(f.fileno(), mapsize, prot=prot)
-                self.assertRaises(TypeError, m.write, b"abcdef")
-                self.assertRaises(TypeError, m.write_byte, 0)
-                m.close()
+                try:
+                    m = mmap.mmap(f.fileno(), mapsize, prot=prot)
+                except PermissionError:
+                    # on macOS 14, PROT_READ | PROT_WRITE is not allowed
+                    pass
+                else:
+                    self.assertRaises(TypeError, m.write, b"abcdef")
+                    self.assertRaises(TypeError, m.write_byte, 0)
+                    m.close()
 
     def test_bad_file_desc(self):
         # Try opening a bad file descriptor...

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to