diff options
author | Victor Stinner <vstinner@python.org> | 2023-09-26 22:26:34 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-26 22:26:34 (GMT) |
commit | 9dbfe2dc8e7bba25e52f9470ae6969821a365297 (patch) | |
tree | 8aead442677b2ad1ae667ac55074cfca0e346948 /Lib | |
parent | 9abba715e3225b8e4c4b7dd0ed528ef3a3057bea (diff) | |
download | cpython-9dbfe2dc8e7bba25e52f9470ae6969821a365297.zip cpython-9dbfe2dc8e7bba25e52f9470ae6969821a365297.tar.gz cpython-9dbfe2dc8e7bba25e52f9470ae6969821a365297.tar.bz2 |
gh-107888: Fix test_mmap.test_access_parameter() on macOS 14 (#109928)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_mmap.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Lib/test/test_mmap.py b/Lib/test/test_mmap.py index bab8686..92c99d6 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_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... |