summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-10-02 10:09:54 (GMT)
committerGitHub <noreply@github.com>2023-10-02 10:09:54 (GMT)
commitbb35fc3706a8b605c66ef161b7afb9b64cb7a339 (patch)
tree5e46bec1c555a745c170ec265ddc9962d4eb57de
parent6f6ca1daa4a1452bcb4a3e900767333d1f97b937 (diff)
downloadcpython-bb35fc3706a8b605c66ef161b7afb9b64cb7a339.zip
cpython-bb35fc3706a8b605c66ef161b7afb9b64cb7a339.tar.gz
cpython-bb35fc3706a8b605c66ef161b7afb9b64cb7a339.tar.bz2
[3.12] gh-107888: Fix test_mmap.test_access_parameter() on macOS 14 (GH-109928) (#109929)
gh-107888: Fix test_mmap.test_access_parameter() on macOS 14 (GH-109928) (cherry picked from commit 9dbfe2dc8e7bba25e52f9470ae6969821a365297) Co-authored-by: Victor Stinner <vstinner@python.org>
-rw-r--r--Lib/test/test_mmap.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/Lib/test/test_mmap.py b/Lib/test/test_mmap.py
index bab8686..dfcf303 100644
--- a/Lib/test/test_mmap.py
+++ b/Lib/test/test_mmap.py
@@ -255,10 +255,15 @@ class MmapTests(unittest.TestCase):
# 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_EXEC 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...