mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
[3.11] gh-107888: Fix test_mmap.test_access_parameter() on macOS 14 (GH-109928) (#109930)
gh-107888: Fix test_mmap.test_access_parameter() on macOS 14 (GH-109928)
(cherry picked from commit 9dbfe2dc8e
)
Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
4e66eca489
commit
88917ddf44
1 changed files with 9 additions and 4 deletions
|
@ -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...
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue