[New-bugs-announce] [issue12462] time.sleep(1): call PyErr_CheckSignals() if the sleep was interrupted

STINNER Victor report at bugs.python.org
Fri Jul 1 12:25:06 CEST 2011


New submission from STINNER Victor <victor.stinner at haypocalc.com>:

While reading floatsleep() (time.sleep) code for issue #12459, I noticed that the Python signal handler is not called in floatsleep() if a signal interrupted the sleep. Well, it just "works" because the bytecode evaluation loop will call PyErr_CheckSignals() before executing the next instruction (the C signal handler signals calls Py_AddPendingCall whichs signals that the pending call to the eval loop using "eval_breaker"), but it would be better to call it directly.

Attached calls explicitly and immediatly PyErr_CheckSignals() in the sleep and Windows implementations of floatsleep().

It's not really a bug, so I prefer to not touch Python 2.7 and 3.2, only Python 3.3.

----------
components: Library (Lib)
files: sleep_signal.patch
keywords: patch
messages: 139562
nosy: haypo, pitrou
priority: normal
severity: normal
status: open
title: time.sleep(1): call PyErr_CheckSignals() if the sleep was interrupted
versions: Python 3.3
Added file: http://bugs.python.org/file22534/sleep_signal.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12462>
_______________________________________


More information about the New-bugs-announce mailing list