New issue 2495: time.sleep() not interruptible on non-win32
https://bitbucket.org/pypy/pypy/issues/2495/timesleep-not-interruptible-on-non-win32

CFSworks:

The current implementation of time.sleep() on non-win32 has 
[this](https://bitbucket.org/pypy/pypy/src/6f28fc42ee453285773b22e40cb0581e2a9878a9/pypy/module/time/interp_time.py?at=py3.5&fileviewer=file-view-default#interp_time.py-472)
 retry handler that attempts to repeat the select call if it exited short of 
the deadline.

I haven't researched the legitimate purpose of the retry logic well enough to 
know if it should go away altogether, but it should not retry if the select() 
call was interrupted as a result of any (non-ignored) signal. On CPython 3.x, 
any non-ignored signal causes time.sleep() to return early.

Note: I haven't checked win32 and I haven't checked the proper behavior with 
threaded applications, although the "as decreed by Guido, only the main thread 
can be interrupted." comment a little lower in the file suggests that 
time.sleep() should only retry if it's running in a separate thread. This 
behavior would make the most intuitive sense if the main thread is the only one 
that runs signal handlers, but I'm not knowledgeable enough on Python's signal 
handling to know for sure.


_______________________________________________
pypy-issue mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-issue

Reply via email to