CYGWIN: Python-3.16.0a1 doesn't select correct strerror_r()
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 60/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- c
调研方向
该错误位于 Python/fileutils.c 中的 _Py_strerror,第 3319 行附近的预处理器代码块在 Py_STRERROR_R_GNU 与 XSI 变体之间做选择,而第 3353 和 3373 行附近的两个 strerror_r 调用在 Cygwin 上无法编译。请阅读该特性检测代码块以及报告者提出的 __CYGWIN__ 条件,然后检查 configure.ac 是否已经检测 strerror_r 的签名。完成的标准是:Cygwin 构建能够编译且没有 int-conversion 错误,并在该平台上选择 GNU 分支。
由索引模型根据 Issue 内容生成。
描述
Bug report
Python-3.16.0a1 has been released, so I tried to build it on Cygwin.
Unfortunately, this error happens:
Python-3.16.0a1/Python/fileutils.c: In function ‘_Py_strerror’:
Python-3.16.0a1/Python/fileutils.c:3353:15: error: initialization of ‘int’ from ‘char *’ makes integer from pointer without a cast [-Wint-conversion]
3353 | int len = strerror_r(code, small_buffer, buflen);
| ^~~~~~~~~~
Python-3.16.0a1/Python/fileutils.c:3373:17: error: assignment to ‘int’ from ‘char *’ makes integer from pointer without a cast [-Wint-conversion]
3373 | len = strerror_r(code, buffer, buflen);
| ^
make: *** [Makefile:3361: Python/fileutils.o] Error 1
I'm thinking that this error comes from a recent change because I had not it in the past builds.
Evidently, Cygwin is also using the GNU version of strerror_r() but the current code doesn't take care of it.
At the moment, I fixed the error with this change:
--- origsrc/Python-3.16.0a1/Python/fileutils.c 2026-10-13 17:05:54.000000000 +0200
+++ src/Python-3.16.0a1/Python/fileutils.c 2026-11-02 13:13:18.366198700 +0100
@@ -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
However, is there a special reason because this test is not done at configure time?
Any comments?
See also issue #149879 "Enhance Cygwin support".
CPython versions tested on:
3.16
Operating systems tested on:
Windows
- 主要语言
- Python
- 星标
- 77.8k
- 派生
- 37.7k
- 平均合并
- 17 小时 24 分钟
- 30 天内合并 PR
- 716
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
python/cpython 的其他 Issue
-
What's New in 3.12 credits the unstable C API tier to PEP 697 instead of PEP 689可能已有人在做 @TheLouisMahdi 于 1 天前认领。 未关闭docs
难度 1/5 1 小时以内 新手友好度 82/100
python/cpython#161078 · 3 条评论 ·
维护者通常 1 天内回复
-
OS-windows type-bug
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
docs
难度 2/5 1-3 小时 新手友好度 72/100
python/cpython#161007 · 4 条评论 ·
维护者通常 1 天内回复
-
Null dereferencing of a pointer in initconfig.c可能已有人在做 @lazerg 于 4 天前认领。 未关闭interpreter-core topic-C-API type-bug
难度 2/5 1-3 小时 新手友好度 72/100
python/cpython#160962 · 4 条评论 ·
维护者通常 1 天内回复
-
tests topic-profiling type-bug
难度 2/5 1-3 小时 新手友好度 76/100
python/cpython#160881 · 1 条评论 ·
维护者通常 1 天内回复
相似的 Issue
-
ci-rerun: collect.py fails a whole pr-babysit cycle on one transient GitHub 5xx and never retries未关闭follow-up
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
-
Built-in QUBO fallback applies bitwise xor to floating binary states可能已有人在做 @iloveeyjafjalla 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
qboson/kaiwu-pytorch-plugin#1702 ·
维护者通常 3 天内回复
-
bug v2
难度 2/5 1-3 小时 新手友好度 76/100
modelcontextprotocol/python-sdk#3811 ·
维护者通常 1 天内回复
-
cost:cheap practicality:seen-in-the-wild severity:medium
难度 2/5 1-3 小时 新手友好度 72/100
fairagro/m4.2_advanced_middleware_api#620 ·
维护者通常 1 天内回复