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
31fac6c5
Commit
31fac6c5
authored
Mar 14, 2010
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better error output
parent
db6f9896
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
Cython/Compiler/Options.py
Cython/Compiler/Options.py
+7
-4
No files found.
Cython/Compiler/Options.py
View file @
31fac6c5
...
...
@@ -102,11 +102,12 @@ def parse_directive_value(name, value, relaxed_bool=False):
>>> parse_directive_value('boundscheck', 'true')
Traceback (most recent call last):
...
ValueError: boundscheck directive must be set to True or False
ValueError: boundscheck directive must be set to True or False
, got 'true'
"""
type
=
directive_types
.
get
(
name
)
if
not
type
:
return
None
orig_value
=
value
if
type
is
bool
:
value
=
str
(
value
)
if
value
==
'True'
:
return
True
...
...
@@ -115,12 +116,14 @@ def parse_directive_value(name, value, relaxed_bool=False):
value
=
value
.
lower
()
if
value
in
(
"true"
,
"yes"
):
return
True
elif
value
in
(
"false"
,
"no"
):
return
False
raise
ValueError
(
"%s directive must be set to True or False"
%
name
)
raise
ValueError
(
"%s directive must be set to True or False, got %r"
%
(
name
,
orig_value
))
elif
type
is
int
:
try
:
return
int
(
value
)
except
ValueError
:
raise
ValueError
(
"%s directive must be set to an integer"
%
name
)
raise
ValueError
(
"%s directive must be set to an integer, got %r"
%
(
name
,
orig_value
))
elif
type
is
str
:
return
str
(
value
)
else
:
...
...
@@ -143,7 +146,7 @@ def parse_directive_list(s, relaxed_bool=False, ignore_unknown=False):
>>> parse_directive_list('boundscheck=hey')
Traceback (most recent call last):
...
ValueError: boundscheck directive must be set to True or False
ValueError: boundscheck directive must be set to True or False
, got 'hey'
>>> parse_directive_list('unknown=True')
Traceback (most recent call last):
...
...
...
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