Skip to content

Commit

Permalink
Restore warning about re-patching ast
Browse files Browse the repository at this point in the history
  • Loading branch information
lieryan committed Oct 9, 2021
1 parent 0415e74 commit 214cb56
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions rope/refactor/patchedast.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 214cb56

Please sign in to comment.