From 4bcea915db70d6e1ceb42df8e9b923543656b5f6 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Wed, 22 Jul 2026 12:05:06 +0300 Subject: [PATCH] gh-154437: Fix test_getcwd_long_path on DragonFly BSD (GH-154438) DragonFly BSD raises EFAULT instead of ENAMETOOLONG when the path exceeds PATH_MAX. (cherry picked from commit 1bf86c134a5260876ad31fb32b832cbea24c21ad) Co-authored-by: Serhiy Storchaka Co-authored-by: Claude Opus 4.8 --- Lib/test/test_os.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 3942877215f53e..8c41d9799b5fa9 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -168,7 +168,8 @@ def test_getcwd_long_path(self): # ("The filename or extension is too long") break except OSError as exc: - if exc.errno == errno.ENAMETOOLONG: + # DragonFly BSD raises EFAULT for a too long path. + if exc.errno in (errno.ENAMETOOLONG, errno.EFAULT): break else: raise