@ -29,6 +29,7 @@ import os # Somewhat exposed through the API.
import random
import random
import re # Exposed through the API.
import re # Exposed through the API.
import signal
import signal
import six
import sys # Parts exposed through API.
import sys # Parts exposed through API.
import tempfile # Exposed through the API.
import tempfile # Exposed through the API.
import threading
import threading
@ -1659,20 +1660,16 @@ class PresubmitExecuter(object):
try :
try :
result = eval ( function_name + ' (*__args) ' , context )
result = eval ( function_name + ' (*__args) ' , context )
self . _check_result_type ( result )
self . _check_result_type ( result )
except Exception as e :
except Exception :
if sink :
if sink :
elapsed_time = time_time ( ) - start_time
elapsed_time = time_time ( ) - start_time
sink . report ( function_name , rdb_wrapper . STATUS_FAIL , elapsed_time )
sink . report ( function_name , rdb_wrapper . STATUS_FAIL , elapsed_time )
# TODO(crbug.com/953884): replace r aise_from with native py3:
# TODO(crbug.com/953884): replace r er aise with native py3:
# raise .. from e
# raise .. from e
try :
e_type , e_value , e_tb = sys . exc_info ( )
from future . utils import raise_from
six . reraise ( e_type , ' Evaluation of %s failed: %s ' % ( function_name ,
raise_from ( type ( e ) ( ' Evaluation of %s failed: %s ' % ( function_name , e ) ) ,
e_value ) ,
e )
e_tb )
except ImportError :
if self . verbose :
traceback . print_exc ( )
raise type ( e ) ( ' Evaluation of %s failed: %s ' % ( function_name , e ) )
if sink :
if sink :
elapsed_time = time_time ( ) - start_time
elapsed_time = time_time ( ) - start_time