From: Serhiy Storchaka Date: Mon, 20 Jul 2026 14:22:51 +0000 (+0300) Subject: gh-154260: Fix test_flush_parameters on DragonFly BSD (GH-154261) X-Git-Url: http://git.ipfire.org/index.cgi?a=commitdiff_plain;h=fc4d93dcf1a01f56fd8ffc35b6d3700c98ffa6c9;p=thirdparty%2FPython%2Fcpython.git 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 --- 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)