aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2012-09-25 11:48:50 -0400
committerBenjamin Peterson <benjamin@python.org>2012-09-25 11:48:50 -0400
commit1654d74e9a6250491bfb923424c4cf83af2af7a6 (patch)
treeec3486c311f2dfcc5fb57f6dc99f471206b2d08d /Lib/lib2to3/fixer_util.py
parentfix test_compileall when run with -O[O] (diff)
downloadcpython-1654d74e9a6250491bfb923424c4cf83af2af7a6.tar.gz
cpython-1654d74e9a6250491bfb923424c4cf83af2af7a6.tar.bz2
cpython-1654d74e9a6250491bfb923424c4cf83af2af7a6.zip
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 92f0da95162..2b5bb1dfd27 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):