Permalink
Browse files

Command line option for debug flags.

  • Loading branch information...
1 parent 3efa38a commit 0718018ad45db09361577c01f1ec8852af258bd8 @robertwb robertwb committed Sep 11, 2010
Showing with 11 additions and 1 deletion.
  1. +9 −1 Cython/Compiler/CmdLine.py
  2. +2 −0 Cython/Compiler/DebugFlags.py
View
10 Cython/Compiler/CmdLine.py
@@ -125,9 +125,17 @@ def get_param(option):
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"):
View
2 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

0 comments on commit 0718018

Please sign in to comment.