From c3a114e1df65d5ea33a53721731e738113e88a43 Mon Sep 17 00:00:00 2001 From: Tim Savannah Date: Sat, 20 May 2017 15:49:17 -0400 Subject: [PATCH] Sometimes depending on critical section during timeout, traceback could be printed to stderr. Stop that. --- func_timeout/dafunc.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/func_timeout/dafunc.py b/func_timeout/dafunc.py index 3b6ed92..f69786e 100644 --- a/func_timeout/dafunc.py +++ b/func_timeout/dafunc.py @@ -61,6 +61,9 @@ def func_timeout(timeout, func, args=(), kwargs=None): def funcwrap(args2, kwargs2): try: ret.append( func(*args2, **kwargs2) ) + except FunctionTimedOut: + # Don't print traceback to stderr if we time out + pass except Exception as e: if isStopped is False: # Don't capture stopping exception