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
Gwenaël Samain
cython
Commits
0134568d
Commit
0134568d
authored
Jul 04, 2017
by
Jeroen Demeyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Give an error for invalid options or directives
parent
4c655740
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
Cython/Compiler/Main.py
Cython/Compiler/Main.py
+9
-4
No files found.
Cython/Compiler/Main.py
View file @
0134568d
...
...
@@ -553,19 +553,24 @@ class CompilationOptions(object):
# ignore valid options that are not in the defaults
unknown_options
.
difference_update
([
'include_path'
])
if
unknown_options
:
# 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
))
import
warnings
warnings
.
warn
(
message
)
raise
ValueError
(
message
)
directives
=
dict
(
options
[
'compiler_directives'
])
# copy mutable field
# check for invalid directives
unknown_options
=
set
(
directives
)
-
set
(
Options
.
get_directive_defaults
())
if
unknown_options
:
message
=
"got unknown compiler directive%s: %s"
%
(
's'
if
len
(
unknown_options
)
>
1
else
''
,
', '
.
join
(
unknown_options
))
raise
ValueError
(
message
)
options
[
'compiler_directives'
]
=
directives
if
directives
.
get
(
'np_pythran'
,
False
)
and
not
options
[
'cplus'
]:
import
warnings
warnings
.
warn
(
"C++ mode forced when in Pythran mode!"
)
options
[
'cplus'
]
=
True
options
[
'compiler_directives'
]
=
directives
if
'language_level'
in
directives
and
'language_level'
not
in
kw
:
options
[
'language_level'
]
=
int
(
directives
[
'language_level'
])
if
'formal_grammar'
in
directives
and
'formal_grammar'
not
in
kw
:
...
...
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