python / python/cpython

Add `mutate_flag` parameter for `fcntl.fcntl`

未关闭
#140,597 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

extension-modules stdlib topic-IO type-feature
主要语言
Python
星标
77.2k
派生
35.9k
PR 合并指标
PR 指标待抓取

描述

Feature or enhancement

Proposal:

fcntl.ioctl has a mutate_flag parameter. When set to True, it will pass the arg buffer to the underlying ioctl syscall directly. This is useful for receiving the result which will be written to the arg buffer.

However, fcntl.fcntl doesn't have this parameter, and it only returns bytes as the modified arg buffer. Users need to parse the bytes using the struct module, even if they have a well-defined structure that already implements the write buffer protocol.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 fcntl.fcntl 和 fcntl.ioctl 入口点开始,比较 ioctl 如何处理 mutate_flag 与当前 fcntl 行为之间的差异。检查现有的 fcntl 测试和 buffer protocol 的预期;当 fcntl.fcntl 支持所提议的参数,并且测试覆盖接收修改后的 buffer 而不需要 struct parsing 时,这项工作就完成了。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
operating-systems
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。