summaryrefslogtreecommitdiff
path: root/Lib/lib2to3/fixer_util.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2012-09-29 09:27:15 +0200
committerGeorg Brandl <georg@python.org>2012-09-29 09:27:15 +0200
commit99a247fd01c1cd780c0c3ee1116657627f1ee744 (patch)
tree319e33cb6612c3fafb2eb82e15c5e85e3d771e4f /Lib/lib2to3/fixer_util.py
parent1628eaa5dc8892ff381ca7558cc7c8d80fac494d (diff)
parent8ed677db129171317b8ee7cd45b39b9013f5a2d6 (diff)
downloadcpython-git-99a247fd01c1cd780c0c3ee1116657627f1ee744.tar.gz
Merge with main repo default branch.
Diffstat (limited to 'Lib/lib2to3/fixer_util.py')
-rw-r--r--Lib/lib2to3/fixer_util.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/lib2to3/fixer_util.py b/Lib/lib2to3/fixer_util.py
index 92f0da9516..2b5bb1dfd2 100644
--- a/Lib/lib2to3/fixer_util.py
+++ b/Lib/lib2to3/fixer_util.py
@@ -274,9 +274,9 @@ def find_root(node):
"""Find the top level namespace."""
# Scamper up to the top level namespace
while node.type != syms.file_input:
- assert node.parent, "Tree is insane! root found before "\
- "file_input node was found."
node = node.parent
+ if not node:
+ raise ValueError("root found before file_input node was found.")
return node
def does_tree_import(package, name, node):