summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2000-03-24 20:35:20 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2000-03-24 20:35:20 (GMT)
commitc24ca4b192559526797d0410bf3cee2fecaaddf5 (patch)
tree188282d0d074c20c7bd2da67e33025cdcae82dca
parent70b5d47f71dc233d13ae40e214be24472b8c58af (diff)
downloadcpython-c24ca4b192559526797d0410bf3cee2fecaaddf5.zip
cpython-c24ca4b192559526797d0410bf3cee2fecaaddf5.tar.gz
cpython-c24ca4b192559526797d0410bf3cee2fecaaddf5.tar.bz2
Fix probable bug; if errno == EINTR, floatsleep() doesn't break out of
a Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS block, but it calls Py_BLOCK_THREADS anyway. The change moves Py_BLOCK_THREADS to inside the if, so it's only executed when the function actually returns unexpectedly.
-rw-r--r--Modules/timemodule.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index d5a598b..b01366a 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -755,12 +755,12 @@ floatsleep(double secs)
t.tv_usec = (long)(frac*1000000.0);
Py_BEGIN_ALLOW_THREADS
if (select(0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &t) != 0) {
- Py_BLOCK_THREADS
#ifdef EINTR
if (errno != EINTR) {
#else
if (1) {
#endif
+ Py_BLOCK_THREADS
PyErr_SetFromErrno(PyExc_IOError);
return -1;
}