[3.15] gh-154260: Fix test_flush_parameters on DragonFly BSD (GH-154261) (GH-154269)

serhiy-storchaka <[email protected]>
Newsgroups gmane.comp.python.cvs
Message-ID <[email protected]>
https://github.com/python/cpython/commit/c6c1e9d7b42f3bbd0263a2f5bc18c8c318d1138e
commit: c6c1e9d7b42f3bbd0263a2f5bc18c8c318d1138e
branch: 3.15
author: Miss Islington (bot) <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2026-07-20T18:22:59Z
summary:

[3.15] gh-154260: Fix test_flush_parameters on DragonFly BSD (GH-154261) (GH-154269)

DragonFly, like FreeBSD, rejects mmap.flush() with MS_ASYNC|MS_INVALIDATE
(EINVAL).  Use str.startswith() so the check also matches DragonFly, whose
sys.platform carries a version suffix.
(cherry picked from commit fc4d93dcf1a01f56fd8ffc35b6d3700c98ffa6c9)

Co-authored-by: Serhiy Storchaka <[email protected]>
Co-authored-by: Claude Fable 5 <[email protected]>

files:
M Lib/test/test_mmap.py

diff --git a/Lib/test/test_mmap.py b/Lib/test/test_mmap.py
index 5be9dfac2f5a76..55c6ad04d44d82 100644
--- a/Lib/test/test_mmap.py
+++ b/Lib/test/test_mmap.py
@@ -1176,8 +1176,8 @@ 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'):
-                if sys.platform == 'freebsd':
-                    # FreeBSD doesn't support this combination
+                if sys.platform.startswith(('freebsd', 'dragonfly')):
+                    # FreeBSD and DragonFly don'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)

_______________________________________________
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]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.