projects
/
platform
/
upstream
/
python-cython.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c64a5e8
)
Fix self-assignment warnings.
author
Robert Bradshaw
<robertwb@gmail.com>
Fri, 4 Oct 2013 06:21:45 +0000
(23:21 -0700)
committer
Robert Bradshaw
<robertwb@gmail.com>
Fri, 4 Oct 2013 06:21:45 +0000
(23:21 -0700)
This is somewhat of a Gordian Knot approach, but seems to do the trick.
Cython/Compiler/Code.py
patch
|
blob
|
history
diff --git
a/Cython/Compiler/Code.py
b/Cython/Compiler/Code.py
index
1f51f1f
..
c2f4af9
100644
(file)
--- a/
Cython/Compiler/Code.py
+++ b/
Cython/Compiler/Code.py
@@
-62,6
+62,8
@@
modifier_output_mapper = {
'inline': 'CYTHON_INLINE'
}.get
+is_self_assignment = re.compile(r" *(\w+) = (\1);\s*$").match
+
def get_utility_dir():
# make this a function and not global variables:
@@
-1555,6
+1557,8
@@
class CCodeWriter(object):
self.put(code)
def put(self, code):
+ if is_self_assignment(code):
+ return
fix_indent = False
if "{" in code:
dl = code.count("{")