summaryrefslogtreecommitdiffstats
path: root/Lib/lib2to3/fixer_util.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2012-09-25 15:48:50 (GMT)
committerBenjamin Peterson <benjamin@python.org>2012-09-25 15:48:50 (GMT)
commitba66c2280f47747ab8ed3c7a8c5d5e989a63ebbb (patch)
tree9be05aae21dbc441056624033ce5d1920980d3ab /Lib/lib2to3/fixer_util.py
parent0dea936e788a760e5d4dafb36b8584771b52da3c (diff)
downloadcpython-ba66c2280f47747ab8ed3c7a8c5d5e989a63ebbb.zip
cpython-ba66c2280f47747ab8ed3c7a8c5d5e989a63ebbb.tar.gz
cpython-ba66c2280f47747ab8ed3c7a8c5d5e989a63ebbb.tar.bz2
switch assertion to an explicit ValueError
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 30da893..350a62a 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):