diff --git a/rope/refactor/patchedast.py b/rope/refactor/patchedast.py index 5a8c59dd7..d8ed4e063 100644 --- a/rope/refactor/patchedast.py +++ b/rope/refactor/patchedast.py @@ -97,6 +97,15 @@ def __call__(self, node): node.sorted_children = ast.get_children(node) def _handle(self, node, base_children, eat_parens=False, eat_spaces=False): + if hasattr(node, "region"): + # ???: The same node was seen twice; what should we do? + warnings.warn( + "Node <%s> has been already patched; please report!" + % node.__class__.__name__, + RuntimeWarning, + ) + return + base_children = collections.deque(base_children) self.children_stack.append(base_children) children = collections.deque()