https://github.com/python/cpython/commit/c3bfe5d5aa557e98b9ab53b8dbe9887c8c80be35
commit: c3bfe5d5aa557e98b9ab53b8dbe9887c8c80be35
branch: main
author: AN Long <[email protected]>
committer: picnixz <[email protected]>
date: 2025-12-28T16:36:52+01:00
summary:

gh-63016: fix failing `mmap.flush` tests on FreeBSD (#143230)

Fix `mmap.flush` tests introduced in 1af21ea32043ad5bd4eaacd48a1718d4e0bef945
where some flag combinations are not supported on FreeBSD.

files:
M Lib/test/test_mmap.py

diff --git a/Lib/test/test_mmap.py b/Lib/test/test_mmap.py
index bc3593ce4ba992..48bf246cadd2f8 100644
--- a/Lib/test/test_mmap.py
+++ b/Lib/test/test_mmap.py
@@ -1173,7 +1173,13 @@ def test_flush_parameters(self):
             if hasattr(mmap, 'MS_INVALIDATE'):
                 m.flush(PAGESIZE * 2, flags=mmap.MS_INVALIDATE)
             if hasattr(mmap, 'MS_ASYNC') and hasattr(mmap, 'MS_INVALIDATE'):
-                m.flush(0, PAGESIZE, flags=mmap.MS_ASYNC | mmap.MS_INVALIDATE)
+                if sys.platform == 'freebsd':
+                    # FreeBSD doesn't support this combination
+                    with self.assertRaises(OSError) as cm:
+                        m.flush(0, PAGESIZE, flags=mmap.MS_ASYNC | 
mmap.MS_INVALIDATE)
+                    self.assertEqual(cm.exception.errno, errno.EINVAL)
+                else:
+                    m.flush(0, PAGESIZE, flags=mmap.MS_ASYNC | 
mmap.MS_INVALIDATE)
 
     @unittest.skipUnless(sys.platform == 'linux', 'Linux only')
     @support.requires_linux_version(5, 17, 0)

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to