From: Robert Bradshaw Date: Sat, 11 Sep 2010 21:19:09 +0000 (-0700) Subject: Command line option for debug flags. X-Git-Tag: 0.14.alpha0~328 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0718018ad45db09361577c01f1ec8852af258bd8;p=cython.git Command line option for debug flags. --- 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