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
bbfaa7e3
Commit
bbfaa7e3
authored
Jul 10, 2017
by
Robert Bradshaw
Committed by
GitHub
Jul 10, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1759 from jdemeyer/invalid_directives
Give an error for invalid options or directives
parents
5ac65106
0134568d
Changes
1
Hide 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 @
bbfaa7e3
...
...
@@ -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