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.
Created on 2011年07月01日 10:25 by vstinner, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| sleep_signal.patch | vstinner, 2011年07月01日 10:25 | review | ||
| sleep_signal-2.patch | vstinner, 2011年07月01日 11:13 | review | ||
| Messages (5) | |||
|---|---|---|---|
| msg139562 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2011年07月01日 10:25 | |
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. |
|||
| msg139564 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2011年07月01日 10:28 | |
You don't *need* to call PyErr_CheckSignals() explicitly, PyErr_SetFromErrno() does it for you. |
|||
| msg139567 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2011年07月01日 11:13 | |
The sleep implementation of floatsleep() doesn't call PyErr_SetFromErrno() if errno is EINTR, whereas EINTR indicates that select() was interrupted. I agree that PyErr_CheckSignals() is overkill in the Windows implementation. My new patch is more explicit: only add a special case for the select implementation, if errno is EINTR. |
|||
| msg139568 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2011年07月01日 11:47 | |
> My new patch is more explicit: only add a special case for the select > implementation, if errno is EINTR. Looks good to me! |
|||
| msg139570 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2011年07月01日 12:19 | |
New changeset 583be15e22ca by Victor Stinner in branch 'default': Issue #12462: time.sleep() now calls immediatly the (Python) signal handler if http://hg.python.org/cpython/rev/583be15e22ca |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:19 | admin | set | github: 56671 |
| 2011年07月01日 12:20:34 | vstinner | set | status: open -> closed resolution: fixed |
| 2011年07月01日 12:19:31 | python-dev | set | nosy:
+ python-dev messages: + msg139570 |
| 2011年07月01日 11:47:36 | pitrou | set | messages: + msg139568 |
| 2011年07月01日 11:13:33 | vstinner | set | files:
+ sleep_signal-2.patch messages: + msg139567 |
| 2011年07月01日 10:28:03 | pitrou | set | messages: + msg139564 |
| 2011年07月01日 10:25:05 | vstinner | create | |