Ver código fonte

Turn 'unknown function', '[unknown location] ' into constants

jonathanvdc 8 anos atrás
pai
commit
5079821383
1 arquivos alterados com 8 adições e 2 exclusões
  1. 8 2
      kernel/modelverse_jit/runtime.py

+ 8 - 2
kernel/modelverse_jit/runtime.py

@@ -52,13 +52,19 @@ BASELINE_JIT_ORIGIN_NAME = "baseline-jit"
 FAST_JIT_ORIGIN_NAME = "fast-jit"
 """The origin name for functions that were produced by the fast JIT."""
 
+UNKNOWN_FUNCTION_REPR = "unknown function"
+"""The representation used for unknown functions in stack traces."""
+
+UNKNOWN_LOCATION_REPR = "[unknown location] "
+"""The representation used for unknown locations in stack traces."""
+
 def format_stack_frame(function_name, debug_info, origin='unknown'):
     """Formats a stack frame, which consists of a function name, debug
        information and an origin."""
     if function_name is None:
-        function_name = 'unknown function'
+        function_name = UNKNOWN_FUNCTION_REPR
     if debug_info is None:
-        debug_info = '[unknown location] '
+        debug_info = UNKNOWN_LOCATION_REPR
 
     return '%sin %s (%s)' % (debug_info, function_name, origin)