From fc4d93dcf1a01f56fd8ffc35b6d3700c98ffa6c9 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Mon, 20 Jul 2026 17:22:51 +0300 Subject: [PATCH] gh-154260: Fix test_flush_parameters on DragonFly BSD (GH-154261) 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. Co-authored-by: Claude Fable 5 --- Lib/test/test_mmap.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_mmap.py b/Lib/test/test_mmap.py index 5be9dfac2f5a..55c6ad04d44d 100644 --- a/Lib/test/test_mmap.py +++ b/Lib/test/test_mmap.py @@ -1176,8 +1176,8 @@ class MmapTests(unittest.TestCase): 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) -- 2.47.3