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

Skip to content

Commit 7b401f4

Browse files
committed
gh-107888: Fix test_mmap.test_access_parameter() on macOS 14
1 parent 87ddfa7 commit 7b401f4

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
< 3EB7 td data-grid-cell-id="diff-72134ea902824c38771f083192b3f7e3cee6d53476fee0fdc5c25b95421b7cdb-264-269-0" data-selected="false" role="gridcell" style="background-color:var(--bgColor-default);text-align:center" tabindex="-1" valign="top" class="focusable-grid-cell diff-line-number position-relative diff-line-number-neutral left-side">264
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):
269
# Try opening a bad file descriptor...

0 commit comments

Comments
 (0)
0