From 7478d1bbfcd2d33cb77ae40e113f2814da26be3e Mon Sep 17 00:00:00 2001 From: tamaki0575-cloud <265693791+tamaki0575-cloud@users.noreply.github.com> Date: Mon, 30 Nov 2026 17:51:40 +1100 Subject: [PATCH] gh-161198: Select the GNU strerror_r variant on Cygwin --- .../next/Build/2026-11-30-12-00-00.gh-issue-161198.YmQ9sK.rst | 1 + Python/fileutils.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Build/2026-11-30-12-00-00.gh-issue-161198.YmQ9sK.rst diff --git a/Misc/NEWS.d/next/Build/2026-11-30-12-00-00.gh-issue-161198.YmQ9sK.rst b/Misc/NEWS.d/next/Build/2026-11-30-12-00-00.gh-issue-161198.YmQ9sK.rst new file mode 100644 index 00000000000000..1c76158db178a4 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2026-11-30-12-00-00.gh-issue-161198.YmQ9sK.rst @@ -0,0 +1 @@ +Fix a build failure on Cygwin when ``strerror_r()`` uses the GNU return type. diff --git a/Python/fileutils.c b/Python/fileutils.c index 3ea0f59f69ad1e..3359b1abae3f51 100644 --- a/Python/fileutils.c +++ b/Python/fileutils.c @@ -3319,7 +3319,7 @@ _Py_strerror(int code) // Check which strerror_r() API is used # if defined(__GLIBC__) && !((_POSIX_C_SOURCE >= 200112L) && !defined(_GNU_SOURCE)) # define Py_STRERROR_R_GNU -# elif defined(__ANDROID__) && defined(_GNU_SOURCE) +# elif (defined(__ANDROID__) || defined(__CYGWIN__)) && defined(_GNU_SOURCE) # define Py_STRERROR_R_GNU # endif #endif