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
e8e3a368
Commit
e8e3a368
authored
May 14, 2009
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compiler directive fixes, add c99 complex directive
parent
74a99576
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
Cython/Compiler/Options.py
Cython/Compiler/Options.py
+8
-1
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+3
-3
No files found.
Cython/Compiler/Options.py
View file @
e8e3a368
...
@@ -64,7 +64,9 @@ option_defaults = {
...
@@ -64,7 +64,9 @@ option_defaults = {
'cdivision'
:
True
,
# Will be False in 0.12
'cdivision'
:
True
,
# Will be False in 0.12
'cdivision_warnings'
:
False
,
'cdivision_warnings'
:
False
,
'always_allow_keywords'
:
False
,
'always_allow_keywords'
:
False
,
'wraparound'
:
True
'wraparound'
:
True
,
'c99_complex'
:
False
,
'a'
:
4
,
}
}
# Override types possibilities above, if needed
# Override types possibilities above, if needed
...
@@ -95,6 +97,11 @@ def parse_option_value(name, value):
...
@@ -95,6 +97,11 @@ def parse_option_value(name, value):
if
value
==
"True"
:
return
True
if
value
==
"True"
:
return
True
elif
value
==
"False"
:
return
False
elif
value
==
"False"
:
return
False
else
:
raise
ValueError
(
"%s directive must be set to True or False"
%
name
)
else
:
raise
ValueError
(
"%s directive must be set to True or False"
%
name
)
elif
type
is
int
:
try
:
return
int
(
value
)
except
ValueError
:
raise
ValueError
(
"%s directive must be set to an integer"
%
name
)
else
:
else
:
assert
False
assert
False
...
...
Cython/Compiler/Parsing.py
View file @
e8e3a368
...
@@ -2488,7 +2488,7 @@ def p_code(s, level=None):
...
@@ -2488,7 +2488,7 @@ def p_code(s, level=None):
repr
(
s
.
sy
),
repr
(
s
.
systring
)))
repr
(
s
.
sy
),
repr
(
s
.
systring
)))
return
body
return
body
COMPILER_DIRECTIVE_COMMENT_RE
=
re
.
compile
(
r"^#\
s*cy
thon:\
s*(
[
a-z_]
+)\
s*=(.*)$
")
COMPILER_DIRECTIVE_COMMENT_RE
=
re
.
compile
(
r"^#\
s*cy
thon:\
s*(
\w
+)\
s*=(.*)$
")
def p_compiler_directive_comments(s):
def p_compiler_directive_comments(s):
result = {}
result = {}
...
@@ -2498,10 +2498,10 @@ def p_compiler_directive_comments(s):
...
@@ -2498,10 +2498,10 @@ def p_compiler_directive_comments(s):
name = m.group(1)
name = m.group(1)
try:
try:
value = Options.parse_option_value(str(name), str(m.group(2).strip()))
value = Options.parse_option_value(str(name), str(m.group(2).strip()))
except ValueError, e:
s.error(e.args[0], fatal=False)
if value is not None: # can be False!
if value is not None: # can be False!
result[name] = value
result[name] = value
except ValueError, e:
s.error(e.args[0], fatal=False)
s.next()
s.next()
return result
return result
...
...
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