summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2014-10-12 07:07:46 +0200
committerStefan Behnel <stefan_ml@behnel.de>2014-10-12 07:07:46 +0200
commitf03bb32c4af3d9cbdefd50c9ba436dfd370dbe07 (patch)
tree62c75b706d96d1043fa1c802f52b7a0747b94b5d
parentc23f143a9aa4245c625d6b164ffd1e469991b4b4 (diff)
downloadcython-f03bb32c4af3d9cbdefd50c9ba436dfd370dbe07.tar.gz
turn cythonize() error on unknown compilation options into a warning
-rw-r--r--CHANGES.rst7
-rw-r--r--Cython/Compiler/Main.py9
2 files changed, 13 insertions, 3 deletions
diff --git a/CHANGES.rst b/CHANGES.rst
index da286ec64..71b918bc8 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -40,6 +40,13 @@ Bugs fixed
* Allow arrays of C++ classes.
+Other changes
+-------------
+
+* Compilation no longer fails hard when unknown compilation options are passed.
+ Instead, it raises a warning and ignores them (as it did silently before 0.21).
+
+
0.21 (2014-09-10)
=================
diff --git a/Cython/Compiler/Main.py b/Cython/Compiler/Main.py
index a9865a949..5d8ae9d70 100644
--- a/Cython/Compiler/Main.py
+++ b/Cython/Compiler/Main.py
@@ -498,11 +498,14 @@ class CompilationOptions(object):
# ignore valid options that are not in the defaults
unknown_options.difference_update(['include_path'])
if unknown_options:
- raise ValueError("got unexpected compilation option%s: %s" % (
+ # TODO: make this a hard error in 0.22
+ message = "got unknown compilation option%s, please remove: %s" % (
's' if len(unknown_options) > 1 else '',
- ', '.join(unknown_options)))
+ ', '.join(unknown_options))
+ import warnings
+ warnings.warn(message)
- directives = dict(options['compiler_directives']) # copy mutable field
+ directives = dict(options['compiler_directives']) # copy mutable field
options['compiler_directives'] = directives
if 'language_level' in directives and 'language_level' not in kw:
options['language_level'] = int(directives['language_level'])