➜

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 the signal module
类型: Stage:
Components: Versions: Python 3.5
process
状态: closed Resolution: fixed
Dependencies: 后续:
分配给: 抄送列表: python-dev, vstinner
优先级: normal 关键字: patch

Created on 2015-03-20 01:13 by vstinner, last changed 2022-04-11 14:58 by admin. This issue is now closed.

文件
文件名 上传时间 Description 编辑
sigtimedwait_eintr.patch vstinner, 2015-03-20 01:13 review
signal_eintr.patch vstinner, 2015-03-20 09:03 review
Messages (8)
msg238595 - (view) Author: STINNER Victor (vstinner) * (Python committer) 日期: 2015-03-20 01:13
Attached patch changes signal.sigtimedwait() to retry if sigtimedwait() failed with EINTR and the signal handler didn't raise an exception.
msg238596 - (view) Author: STINNER Victor (vstinner) * (Python committer) 日期: 2015-03-20 01:18
It looks like signal.sigwaitinfo() can also fail with InterruptedError. It should also be modified.
msg238620 - (view) Author: STINNER Victor (vstinner) * (Python committer) 日期: 2015-03-20 09:03
signal_eintr.py: More complete patch, modify also signal.sigwaitinfo().

--

I don't think that other signal functions need to be modified to handle EINTR.

POSIX manual pages:
- "The pthread_sigmask() function shall not return an error code of [EINTR]."
- "The pthread_kill() function shall not return an error code of [EINTR]."

pause() fails with EINTR when it receives a signal, but signal.pause() doesn't raise InterruptedError in this case, it only returns None, because we expect a signal.

I tested: signal.sigwait([]) doesn't fail with EINTR with a signal is received. No need to modify this function.

On Linux, signal.set_wakeup_fd() doesn't fail with InterruptedError.
msg238651 - (view) Author: Roundup Robot (python-dev) (Python triager) 日期: 2015-03-20 12:02
New changeset 33a6e2587aad by Victor Stinner in branch 'default':
Issue #23715: signal.sigwaitinfo() and signal.sigtimedwait() are now retried
https://hg.python.org/cpython/rev/33a6e2587aad
msg238656 - (view) Author: Roundup Robot (python-dev) (Python triager) 日期: 2015-03-20 12:38
New changeset 8f9925a02fe7 by Victor Stinner in branch 'default':
Issue #23715: Enhance test.script_helper to investigate test_eintr failure
https://hg.python.org/cpython/rev/8f9925a02fe7
msg238659 - (view) Author: Roundup Robot (python-dev) (Python triager) 日期: 2015-03-20 12:43
New changeset 79aed09a9fa5 by Victor Stinner in branch 'default':
Issue #23715: Fix test_eintr, skip tests on signal.sigwaitinfo() and
https://hg.python.org/cpython/rev/79aed09a9fa5
msg238663 - (view) Author: Roundup Robot (python-dev) (Python triager) 日期: 2015-03-20 13:02
New changeset ed8c2a4a6d3d by Victor Stinner in branch 'default':
Issue #23715: Fix test_script_helper
https://hg.python.org/cpython/rev/ed8c2a4a6d3d
msg239403 - (view) Author: Roundup Robot (python-dev) (Python triager) 日期: 2015-03-27 13:36
New changeset 35bc15fa4930 by Victor Stinner in branch 'default':
Issue #23715: Fix test_sigtimedwait() of test_eintr
https://hg.python.org/cpython/rev/35bc15fa4930
历史
日期 用户 动作 参数
2022-04-11 14:58:14admin修改github: 67903
2015-03-27 13:36:01python-dev修改消息: + msg239403
2015-03-20 13:02:47python-dev修改消息: + msg238663
2015-03-20 12:43:44python-dev修改消息: + msg238659
2015-03-20 12:38:53python-dev修改消息: + msg238656
2015-03-20 12:10:39vstinner修改状态: open -> closed
resolution: fixed
2015-03-20 12:02:41python-dev修改抄送: + python-dev
消息: + msg238651
2015-03-20 09:03:25vstinner修改文件: + signal_eintr.patch

消息: + msg238620
2015-03-20 01:19:05vstinner链接issue23648 dependencies
2015-03-20 01:18:36vstinner修改消息: + msg238596
标题: PEP 475: signal.sigtimedwait() must retry if sigtimedwait() failed with EINTR -> PEP 475: handle EINTR in the signal module
2015-03-20 01:13:29vstinner创建