➜

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
标题: PEP 475: handle EINTR in fileutils.c
类型: Stage:
Components: Versions: Python 3.5
process
状态: closed Resolution: fixed
Dependencies: 后续:
分配给: 抄送列表: neologix, python-dev, vstinner
优先级: normal 关键字: patch

Created on 2015-03-17 23:19 by vstinner, last changed 2022-04-11 14:58 by admin. This issue is now closed.

文件
文件名 上传时间 Description 编辑
fileutils_eintr.patch vstinner, 2015-03-18 00:53 review
Messages (9)
msg238358 - (view) Author: STINNER Victor (vstinner) * (Python committer) 日期: 2015-03-17 23:19
fileutils.c must be modified to retry when a function fails with EINTR: see the PEP 475.

I'm working on a patch.
msg238359 - (view) Author: Roundup Robot (python-dev) (Python triager) 日期: 2015-03-17 23:27
New changeset 0b99d7043a99 by Victor Stinner in branch 'default':
Issue #23694: Enhance _Py_open(), it now raises exceptions
https://hg.python.org/cpython/rev/0b99d7043a99
msg238366 - (view) Author: Roundup Robot (python-dev) (Python triager) 日期: 2015-03-18 00:46
New changeset cfe541c694f3 by Victor Stinner in branch 'default':
Issue #23694: Enhance _Py_fopen(), it now raises an exception on error
https://hg.python.org/cpython/rev/cfe541c694f3
msg238367 - (view) Author: STINNER Victor (vstinner) * (Python committer) 日期: 2015-03-18 00:53
fileutils_eintr.patch: handle EINTR for open, fopen and dup (only on Linux for dup in _Py_dup).

_Py_wfopen() and _Py_fopen() are not modified because callers are not really prepared to handle exceptions. These functions are mostly used during early steps of Python initializations. If someone is motived, you can propose a patch for these functions.

For other functions (cwd, readlink, etc.), it's not clear to me if we can get EINTR or not.
msg238381 - (view) Author: Charles-François Natali (neologix) * (Python committer) 日期: 2015-03-18 07:03
LGTM.

Note that dup() cannot fail with EINTR, it is non-blocking: dup2() can
fail, because f the target FD is open, it has to close it, but not
dup().

See e.g. this man page from my Debian:
       EINTR  The dup2() or dup3() call was interrupted by a signal;
see signal(7).
msg238386 - (view) Author: STINNER Victor (vstinner) * (Python committer) 日期: 2015-03-18 08:55
Charles-François Natali added the comment:
> Note that dup() cannot fail with EINTR, it is non-blocking: dup2() can
> fail, because f the target FD is open, it has to close it, but not
> dup().

Oh right, I misread the manual page. I will leave _Py_dup() unchanged.
Thanks for the review.
msg238396 - (view) Author: STINNER Victor (vstinner) * (Python committer) 日期: 2015-03-18 10:08
All functions which can fail with EINTR now retries the function on EINTR. I close the issue.
msg238398 - (view) Author: Roundup Robot (python-dev) (Python triager) 日期: 2015-03-18 10:31
New changeset ed25e945cdc2 by Victor Stinner in branch 'default':
Issue #23694: Handle EINTR in _Py_open() and _Py_fopen_obj()
https://hg.python.org/cpython/rev/ed25e945cdc2
msg239538 - (view) Author: Roundup Robot (python-dev) (Python triager) 日期: 2015-03-30 00:21
New changeset 2e1234208bab by Victor Stinner in branch 'default':
Issue #23694: Fix usage of _Py_open() in the _posixsubprocess module
https://hg.python.org/cpython/rev/2e1234208bab
历史
日期 用户 动作 参数
2022-04-11 14:58:14admin修改github: 67882
2015-03-30 00:21:08python-dev修改消息: + msg239538
2015-03-18 10:31:25python-dev修改消息: + msg238398
2015-03-18 10:08:40vstinner修改状态: open -> closed
resolution: fixed
消息: + msg238396
2015-03-18 08:55:19vstinner修改消息: + msg238386
2015-03-18 07:03:01neologix修改消息: + msg238381
2015-03-18 00:53:54vstinner修改抄送: + neologix
2015-03-18 00:53:46vstinner修改文件: + fileutils_eintr.patch
keywords: + patch
消息: + msg238367
2015-03-18 00:46:24python-dev修改消息: + msg238366
2015-03-17 23:27:26python-dev修改抄送: + python-dev
消息: + msg238359
2015-03-17 23:19:38vstinner创建