-2 Compile based on Python-2 syntax and code semantics.
-3 Compile based on Python-3 syntax and code semantics.
--fast-fail Abort the compilation on the first error
+ --warning-error, -Werror Make all warnings into errors
-X, --directive <name>=<value>[,<name=value,...] Overrides a compiler directive
"""
options.language_level = 3
elif option == "--fast-fail":
Options.fast_fail = True
+ elif option in ('-Werror', '--warning-errors'):
+ Options.warning_errors = True
elif option == "--disable-function-redefinition":
Options.disable_function_redefinition = True
elif option in ("-X", "--directive"):
def warning(position, message, level=0):
if level < LEVEL:
return
+ if Options.warning_errors:
+ return error(position, message)
warn = CompileWarning(position, message)
line = "warning: %s\n" % warn
if listing_file:
# to keep going and printing further error messages.
fast_fail = False
+# Make all warnings into errors.
+warning_errors = False
+
# This will convert statements of the form "for i in range(...)"
# to "for i from ..." when i is a cdef'd integer type, and the direction
# (i.e. sign of step) can be determined.