mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
switch assertion to an explicit ValueError
This commit is contained in:
parent
0dea936e78
commit
ba66c2280f
2 changed files with 3 additions and 3 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue