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
eace932b
Commit
eace932b
authored
Nov 13, 2010
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Inplace analysis fix.
parent
37efecfe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
4 deletions
+13
-4
Cython/Compiler/ExprNodes.py
Cython/Compiler/ExprNodes.py
+5
-2
Cython/Compiler/ParseTreeTransforms.py
Cython/Compiler/ParseTreeTransforms.py
+8
-2
No files found.
Cython/Compiler/ExprNodes.py
View file @
eace932b
...
...
@@ -5359,6 +5359,9 @@ class BinopNode(ExprNode):
def
analyse_types
(
self
,
env
):
self
.
operand1
.
analyse_types
(
env
)
self
.
operand2
.
analyse_types
(
env
)
self
.
analyse_operation
(
env
)
def
analyse_operation
(
self
,
env
):
if
self
.
is_py_operation
():
self
.
coerce_operands_to_pyobjects
(
env
)
self
.
type
=
self
.
result_type
(
self
.
operand1
.
type
,
...
...
@@ -5653,12 +5656,12 @@ class DivNode(NumBinopNode):
except
Exception
,
e
:
self
.
compile_time_value_error
(
e
)
def
analyse_
types
(
self
,
env
):
def
analyse_
operation
(
self
,
env
):
if
self
.
cdivision
or
env
.
directives
[
'cdivision'
]:
self
.
ctruedivision
=
False
else
:
self
.
ctruedivision
=
self
.
truedivision
NumBinopNode
.
analyse_
types
(
self
,
env
)
NumBinopNode
.
analyse_
operation
(
self
,
env
)
if
self
.
is_cpp_operation
():
self
.
cdivision
=
True
if
not
self
.
type
.
is_pyobject
:
...
...
Cython/Compiler/ParseTreeTransforms.py
View file @
eace932b
...
...
@@ -1184,6 +1184,7 @@ class ExpandInplaceOperators(EnvTransform):
# There is code to handle this case.
return
node
env
=
self
.
current_env
()
def
side_effect_free_reference
(
node
,
setting
=
False
):
if
isinstance
(
node
,
NameNode
):
return
node
,
[]
...
...
@@ -1206,18 +1207,23 @@ class ExpandInplaceOperators(EnvTransform):
lhs
,
let_ref_nodes
=
side_effect_free_reference
(
lhs
,
setting
=
True
)
except
ValueError
:
return
node
lhs
.
analyse_types
(
env
)
dup
=
lhs
.
__class__
(
**
lhs
.
__dict__
)
binop
=
binop_node
(
node
.
pos
,
operator
=
node
.
operator
,
operand1
=
dup
,
operand2
=
rhs
,
inplace
=
True
)
node
=
SingleAssignmentNode
(
node
.
pos
,
lhs
=
lhs
,
rhs
=
binop
)
binop
.
analyse_operation
(
env
)
node
=
SingleAssignmentNode
(
node
.
pos
,
lhs
=
lhs
,
rhs
=
binop
.
coerce_to
(
lhs
.
type
,
env
))
# Use LetRefNode to avoid side effects.
let_ref_nodes
.
reverse
()
for
t
in
let_ref_nodes
:
node
=
LetNode
(
t
,
node
)
node
.
analyse_expressions
(
self
.
current_env
())
# Manually analyse types for new node.
return
node
def
visit_ExprNode
(
self
,
node
):
...
...
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