]> arthur.barton.de Git - bup.git/commitdiff
wvtest: precompile _code() regex
authorRob Browning <rlb@defaultvalue.org>
Sat, 27 Aug 2016 16:54:07 +0000 (11:54 -0500)
committerRob Browning <rlb@defaultvalue.org>
Sat, 10 Sep 2016 15:22:20 +0000 (10:22 -0500)
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
wvtest.py

index 9182268438e033e9687479409a0f54f322952171..561cc8794ba8e93fc43be65fbd5a50ba53922bb0 100755 (executable)
--- a/wvtest.py
+++ b/wvtest.py
@@ -71,11 +71,11 @@ if __name__ != '__main__':   # we're imported as a module
             _result(msg, tb, 'FAILED')
         return cond
 
-
+    _code_rx = re.compile(r'^\w+\((.*)\)(\s*#.*)?$')
     def _code():
         (filename, line, func, text) = traceback.extract_stack()[-3]
-        text = re.sub(r'^\w+\((.*)\)(\s*#.*)?$', r'\1', text);
-        return text
+        return _code_rx.sub(r'\1', text)
+
 
 
     def WVMSG(message):