-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Description
Running the following simple code with python 2.7.15:
from stopit import ThreadingTimeout
def func():
with ThreadingTimeout(1, swallow_exc=True):
import time; time.sleep(2)
if __name__ == '__main__':
func()I get the following exception being thrown:
Traceback (most recent call last):
File "main.py", line 8, in <module>
func()
File "main.py", line 5, in func
import time; time.sleep(2)
File "py_envs/py2/lib/python2.7/site-packages/stopit/utils.py", line 87, in __exit__
self.suppress_interrupt()
File "py_envs/py2/lib/python2.7/site-packages/stopit/threadstop.py", line 65, in suppress_interrupt
self.timer.cancel()
File "homebrew/Cellar/python@2/2.7.15_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 1066, in cancel
def cancel(self):
stopit.utils.TimeoutException
When I run with python 3 I don't get any output as expected, because I've swallowed the exception. Any ideas?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels