diff --git a/nodes.py b/nodes.py
index af5c1c50b8da2da9439e7dd9df6d0c97b830f97e_bm9kZXMucHk=..624fd05e875416be67d9c8afa8f62f1e2d7a9463_bm9kZXMucHk= 100644
--- a/nodes.py
+++ b/nodes.py
@@ -949,6 +949,13 @@
     def set_scope(self, scopenode):
         if scopenode is self.stmt or self.stinfo['scope'] is None:
             self.stinfo['scope'] = scopenode
+        elif self.stinfo['scope'] is not self.stmt and scopenode is not self.stinfo['scope']:
+            # XXX get common parent scope if this assertion fail
+            assert scopenode.parent.scope is self.stinfo['scope'].parent.scope, \
+                   (scopenode.parent.scope, self.stinfo['scope'].parent.scope)
+            
+            self.stinfo['scope'] = scopenode.parent.scope
+            
     def get_scope(self):
         return self.stinfo['scope']
     scope = property(get_scope, set_scope)
diff --git a/stmts.py b/stmts.py
index af5c1c50b8da2da9439e7dd9df6d0c97b830f97e_c3RtdHMucHk=..624fd05e875416be67d9c8afa8f62f1e2d7a9463_c3RtdHMucHk= 100644
--- a/stmts.py
+++ b/stmts.py
@@ -162,6 +162,7 @@
     
     def ored(self, traverse_scope=False, _fromnode=None):
         return None
+    
     def neged(self, _fromnode=None, strict=False):
         return None