summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmile Anclin <emile.anclin@logilab.fr>2009-02-16 15:36:02 +0100
committerEmile Anclin <emile.anclin@logilab.fr>2009-02-16 15:36:02 +0100
commita0196df266af67bf2081f13ef232b74af1ed057f (patch)
treea98ad447c66dc83951991ac442609bce62e677b2
parent9b8cd9bf56c2509d2ad9c9e0f4da6f4da2aaf588 (diff)
downloadastroid-git-a0196df266af67bf2081f13ef232b74af1ed057f.tar.gz
more 'are_exclusive' bugs
--HG-- branch : _ast_compat
-rw-r--r--utils.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/utils.py b/utils.py
index cc20da3e..bbdc2c62 100644
--- a/utils.py
+++ b/utils.py
@@ -205,9 +205,11 @@ def _try_except_from_branch(node, stmt):
"""returns values to compare to nodes"""
if stmt in node.body:
return 'body', 1
- if stmt is node.orelse:
+ if stmt in node.orelse:
return 'else', 1
for i, handler in enumerate(node.handlers):
+ if stmt is handler:
+ return 'except', i
if stmt in handler.body:
return 'except', i
raise ASTNGError, "comparing try_except nodes '%s' '%s'" % (node, stmt)