Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
cython
Commits
37b4ce75
Commit
37b4ce75
authored
Jun 25, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
explicitly reject unknown compiler options to make cythonize() less unfriendly to use
parent
1165671b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletion
+13
-1
Cython/Compiler/Main.py
Cython/Compiler/Main.py
+13
-1
No files found.
Cython/Compiler/Main.py
View file @
37b4ce75
...
...
@@ -479,7 +479,7 @@ class CompilationOptions(object):
cplus boolean Compile as c++ code
"""
def
__init__
(
self
,
defaults
=
None
,
**
kw
):
def
__init__
(
self
,
defaults
=
None
,
**
kw
):
self
.
include_path
=
[]
if
defaults
:
if
isinstance
(
defaults
,
CompilationOptions
):
...
...
@@ -490,6 +490,16 @@ class CompilationOptions(object):
options
=
dict
(
defaults
)
options
.
update
(
kw
)
# let's assume 'default_options' contains a value for most known compiler options
# and validate against them
unknown_options
=
set
(
options
)
-
set
(
default_options
)
# 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"
%
(
's'
if
len
(
unknown_options
)
>
1
else
''
,
', '
.
join
(
unknown_options
)))
directives
=
dict
(
options
[
'compiler_directives'
])
# copy mutable field
options
[
'compiler_directives'
]
=
directives
if
'language_level'
in
directives
and
'language_level'
not
in
kw
:
...
...
@@ -675,4 +685,6 @@ default_options = dict(
gdb_debug
=
False
,
compile_time_env
=
None
,
common_utility_include_dir
=
None
,
output_dir
=
None
,
build_dir
=
None
,
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment