diff Modules/parsermodule.c @ 49629:45ac5196fa67 2.5

backport r67077 from the trunk: parser module now correctly validates relative imports
author Benjamin Peterson <benjamin@python.org>
date Mon, 03 Nov 2008 15:19:35 +0000
parents 1fdf29a88f0e
children 787b969d37f0
line wrap: on
line diff
--- a/Modules/parsermodule.c	Thu Oct 30 21:40:05 2008 +0000
+++ b/Modules/parsermodule.c	Mon Nov 03 15:19:35 2008 +0000
@@ -1804,10 +1804,10 @@
 count_from_dots(node *tree)
 {
         int i;
-        for (i = 0; i < NCH(tree); i++)
+        for (i = 1; i < NCH(tree); i++)
 		if (TYPE(CHILD(tree, i)) != DOT)
 			break;
-        return i;
+        return i-1;
 }
 
 /* 'from' ('.'* dotted_name | '.') 'import' ('*' | '(' import_as_names ')' |