Skip to content

Commit 648c44d

Browse files
[3.8] gh-107888: Fix test_mmap.test_access_parameter() on macOS 14 (GH-109928) (GH-114183)
(cherry picked from commit 9dbfe2d) Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent d737623 commit 648c44d

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
@@ -240,10 +240,15 @@ def test_access_parameter(self):
240240
# Try writing with PROT_EXEC and without PROT_WRITE
241241
prot = mmap.PROT_READ | getattr(mmap, 'PROT_EXEC', 0)
242242
with open(TESTFN, "r+b") as f:
243-
m = mmap.mmap(f.fileno(), mapsize, prot=prot)
244-
self.assertRaises(TypeError, m.write, b"abcdef")
245-
self.assertRaises(TypeError, m.write_byte, 0)
246-
m.close()
243+
try:
244+
m = mmap.mmap(f.fileno(), mapsize, prot=prot)
245+
except PermissionError:
246+
# on macOS 14, PROT_READ | PROT_WRITE is not allowed
247+
pass
248+
else:
249+
self.assertRaises(TypeError, m.write, b"abcdef")
250+
self.assertRaises(TypeError, m.write_byte, 0)
251+
m.close()
247252

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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy