[Python-checkins] commit of r41626 - python/trunk/Python/compile.c

neal.norwitz python-checkins at python.org
Tue Dec 6 08:41:31 CET 2005


Author: neal.norwitz
Date: Tue Dec  6 08:41:30 2005
New Revision: 41626

Modified:
   python/trunk/Python/compile.c
Log:
Simplify logic for handling import *

Modified: python/trunk/Python/compile.c
==============================================================================
--- python/trunk/Python/compile.c	(original)
+++ python/trunk/Python/compile.c	Tue Dec  6 08:41:30 2005
@@ -2440,7 +2440,6 @@
 compiler_from_import(struct compiler *c, stmt_ty s)
 {
 	int i, n = asdl_seq_LEN(s->v.ImportFrom.names);
-	int star = 0;
 
 	PyObject *names = PyTuple_New(n);
 	if (!names)
@@ -2474,8 +2473,7 @@
 		if (i == 0 && *PyString_AS_STRING(alias->name) == '*') {
 			assert(n == 1);
 			ADDOP(c, IMPORT_STAR);
-			star = 1;
-			break;
+			return 1;
 		}
 		    
 		ADDOP_NAME(c, IMPORT_FROM, alias->name, names);
@@ -2488,9 +2486,8 @@
 			return 0;
 		}
 	}
-	if (!star) 
-		/* remove imported module */
-		ADDOP(c, POP_TOP);
+	/* remove imported module */
+	ADDOP(c, POP_TOP);
 	return 1;
 }
 


More information about the Python-checkins mailing list