8000 gh-107888: Fix test_mmap.test_access_parameter() on macOS 14 (#109928) · python/cpython@9dbfe2d · GitHub
[go: up one dir, main page]

Skip to content

Commit 9dbfe2d

Browse files
authored
gh-107888: Fix test_mmap.test_access_parameter() on macOS 14 (#109928)
1 parent 9abba71 commit 9dbfe2d

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
@@ -255,10 +255,15 @@ def test_access_parameter(self):
255255
# Try writing with PROT_EXEC and without PROT_WRITE
256256
prot = mmap.PROT_READ | getattr(mmap, 'PROT_EXEC', 0)
257257
with open(TESTFN, "r+b") as f:
258-
m = mmap.mmap(f.fileno(), mapsize, prot=prot)
259-
self.assertRaises(TypeError, m.write, b"abcdef")
260-
self.assertRaises(TypeError, m.write_byte, 0)
261-
m.close()
258+
try:
259+
m = mmap.mmap(f.fileno(), mapsize, prot=prot)
260+
except PermissionError:
261+
# on macOS 14, PROT_READ | PROT_WRITE is not allowed
262+
pass
263+
else:
264+
self.assertRaises(TypeError, m.write, b"abcdef")
265+
self.assertRaises(TypeError, m.write_byte, 0)
266+
m.close()
262267

263268
def test_bad_file_desc(self):
264269
# Try opening a bad file descriptor...

0 commit comments

Comments
 (0)
0