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:
1c36f36
)
simplify search for duplicate values in SwitchTransform and make it safer for unexpec...
author
Stefan Behnel
<stefan_ml@behnel.de>
Sun, 12 May 2013 12:22:16 +0000
(14:22 +0200)
committer
Stefan Behnel
<stefan_ml@behnel.de>
Sun, 12 May 2013 12:22:16 +0000
(14:22 +0200)
Cython/Compiler/Optimize.py
patch
|
blob
|
history
diff --git
a/Cython/Compiler/Optimize.py
b/Cython/Compiler/Optimize.py
index
555ef88
..
b0ae989
100644
(file)
--- a/
Cython/Compiler/Optimize.py
+++ b/
Cython/Compiler/Optimize.py
@@
-874,7
+874,12
@@
class SwitchTransform(Visitor.VisitorTransform):
else:
# this isn't completely safe as we don't know the
# final C value, but this is about the best we can do
- seen.add(getattr(getattr(value, 'entry', None), 'cname'))
+ try:
+ if value.entry.cname in seen:
+ return True
+ except AttributeError:
+ return True # play safe
+ seen.add(value.entry.cname)
return False
def visit_IfStatNode(self, node):