Command line option for debug flags.
authorRobert Bradshaw <robertwb@math.washington.edu>
Sat, 11 Sep 2010 21:19:09 +0000 (14:19 -0700)
committerRobert Bradshaw <robertwb@math.washington.edu>
Sat, 11 Sep 2010 21:19:09 +0000 (14:19 -0700)
Cython/Compiler/CmdLine.py
Cython/Compiler/DebugFlags.py

index 529f335d7621e1002935d99de6fe5adac6da0611..320690b0f2c00dc3932e63175fd53ce7ba3fd55a 100644 (file)
@@ -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"):
index 099a92acdc4f000e9100c89d81e62b8c62462226..e830ab1849cf506ec10ab38ebd850a0a398c0431 100644 (file)
@@ -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