Skip to content

Commit 1274896

Browse files
[3.10] gh-107888: Fix test_mmap.test_access_parameter() on macOS 14 (GH-109928) (GH-114185)
(cherry picked from commit 9dbfe2d) Co-authored-by: Victor Stinner <[email protected]>
1 parent 6661b22 commit 1274896

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Lib/test/test_mmap.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,15 @@ def test_access_parameter(self):
241241
# Try writing with PROT_EXEC and without PROT_WRITE
242242
prot = mmap.PROT_READ | getattr(mmap, 'PROT_EXEC', 0)
243243
with open(TESTFN, "r+b") as f:
244-
m = mmap.mmap(f.fileno(), mapsize, prot=prot)
245-
self.assertRaises(TypeError, m.write, b"abcdef")
246-
self.assertRaises(TypeError, m.write_byte, 0)
247-
m.close()
244+
try:
245+
m = mmap.mmap(f.fileno(), mapsize, prot=prot)
246+
except PermissionError:
247+
# on macOS 14, PROT_READ | PROT_WRITE is not allowed
248+
pass
249+
else:
250+
self.assertRaises(TypeError, m.write, b"abcdef")
251+
self.assertRaises(TypeError, m.write_byte, 0)
252+
m.close()
248253

249254
def test_bad_file_desc(self):
250255
# Try opening a bad file descriptor...

0 commit comments

Comments
 (0)