From 47dc7734e76b46f16df8569e79e5ec85374a0b46 Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Sat, 11 Sep 2010 14:12:04 -0700 Subject: [PATCH] Debug flag for raising an exception on an error. --- Cython/Compiler/DebugFlags.py | 11 +++++++---- Cython/Compiler/Errors.py | 3 ++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Cython/Compiler/DebugFlags.py b/Cython/Compiler/DebugFlags.py index d6d52189..099a92ac 100644 --- a/Cython/Compiler/DebugFlags.py +++ b/Cython/Compiler/DebugFlags.py @@ -3,14 +3,17 @@ debug_temp_alloc = 0 debug_coercion = 0 # Write comments into the C code that show where temporary variables -# are allocated and released +# are allocated and released. debug_temp_code_comments = 0 -# Write a call trace of the code generation phase into the C code +# Write a call trace of the code generation phase into the C code. debug_trace_code_generation = 0 -# Do not replace exceptions with user-friendly error messages +# Do not replace exceptions with user-friendly error messages. debug_no_exception_intercept = 0 -# Print a message each time a new stage in the pipeline is entered +# Print a message each time a new stage in the pipeline is entered. debug_verbose_pipeline = 0 + +# Raise an exception when an error is encountered. +debug_exception_on_error = 0 diff --git a/Cython/Compiler/Errors.py b/Cython/Compiler/Errors.py index cc5e2392..a492e5bb 100644 --- a/Cython/Compiler/Errors.py +++ b/Cython/Compiler/Errors.py @@ -4,6 +4,7 @@ import sys from Cython.Utils import open_new_file +from DebugFlags import debug_exception_on_error class PyrexError(Exception): @@ -143,7 +144,7 @@ def error(position, message): if position is None: raise InternalError(message) err = CompileError(position, message) - #if position is not None: raise Exception(err) # debug + if debug_exception_on_error: raise Exception(err) # debug report_error(err) return err -- 2.26.2