From 0718018ad45db09361577c01f1ec8852af258bd8 Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Sat, 11 Sep 2010 14:19:09 -0700 Subject: [PATCH] Command line option for debug flags. --- Cython/Compiler/CmdLine.py | 10 +++++++++- Cython/Compiler/DebugFlags.py | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Cython/Compiler/CmdLine.py b/Cython/Compiler/CmdLine.py index 529f335d..320690b0 100644 --- a/Cython/Compiler/CmdLine.py +++ b/Cython/Compiler/CmdLine.py @@ -125,9 +125,17 @@ def parse_command_line(args): except ValueError, e: sys.stderr.write("Error in compiler directive: %s\n" % e.args[0]) sys.exit(1) + elif option.startswith('--debug'): + option = option[2:].replace('-', '_') + import DebugFlags + if option in dir(DebugFlags): + setattr(DebugFlags, option, True) + else: + sys.stderr.write("Unknown debug flag: %s\n" % option) + bad_usage() else: sys.stderr.write("Unknown compiler flag: %s\n" % option) - bad_usage() + sys.exit(1) else: arg = pop_arg() if arg.endswith(".pyx"): diff --git a/Cython/Compiler/DebugFlags.py b/Cython/Compiler/DebugFlags.py index 099a92ac..e830ab18 100644 --- a/Cython/Compiler/DebugFlags.py +++ b/Cython/Compiler/DebugFlags.py @@ -1,3 +1,5 @@ +# Can be enabled at the command line with --debug-xxx. + debug_disposal_code = 0 debug_temp_alloc = 0 debug_coercion = 0 -- 2.26.2