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
fe68a83e
Commit
fe68a83e
authored
Apr 06, 2009
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
disable some constant folding operations that can break code
parent
2337909d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+8
-3
No files found.
Cython/Compiler/ExprNodes.py
View file @
fe68a83e
...
@@ -877,7 +877,9 @@ class FloatNode(ConstNode):
...
@@ -877,7 +877,9 @@ class FloatNode(ConstNode):
type
=
PyrexTypes
.
c_double_type
type
=
PyrexTypes
.
c_double_type
def
calculate_constant_result
(
self
):
def
calculate_constant_result
(
self
):
self
.
constant_result
=
float
(
self
.
value
)
# calculating float values is usually not a good idea
#self.constant_result = float(self.value)
pass
def
compile_time_value
(
self
,
denv
):
def
compile_time_value
(
self
,
denv
):
return
float
(
self
.
value
)
return
float
(
self
.
value
)
...
@@ -3889,7 +3891,9 @@ class TypecastNode(NewTempExprNode):
...
@@ -3889,7 +3891,9 @@ class TypecastNode(NewTempExprNode):
self
.
operand
.
check_const
()
self
.
operand
.
check_const
()
def
calculate_constant_result
(
self
):
def
calculate_constant_result
(
self
):
self
.
constant_result
=
self
.
operand
.
constant_result
# we usually do not know the result of a type cast at code
# generation time
pass
def
calculate_result_code
(
self
):
def
calculate_result_code
(
self
):
opnd
=
self
.
operand
opnd
=
self
.
operand
...
@@ -4949,7 +4953,8 @@ class CoercionNode(NewTempExprNode):
...
@@ -4949,7 +4953,8 @@ class CoercionNode(NewTempExprNode):
print
(
"%s Coercing %s"
%
(
self
,
self
.
arg
))
print
(
"%s Coercing %s"
%
(
self
,
self
.
arg
))
def
calculate_constant_result
(
self
):
def
calculate_constant_result
(
self
):
self
.
constant_result
=
self
.
arg
.
constant_result
# constant folding can break type coercion, so this is disabled
pass
def
annotate
(
self
,
code
):
def
annotate
(
self
,
code
):
self
.
arg
.
annotate
(
code
)
self
.
arg
.
annotate
(
code
)
...
...
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