[Python-checkins] CVS: python/dist/src/Python compile.c,2.136,2.137

Thomas Wouters python-dev@python.org
Sun, 27 Aug 2000 13:16:34 -0700


Update of /cvsroot/python/python/dist/src/Python
In directory slayer.i.sourceforge.net:/tmp/cvs-serv9068/Python

Modified Files:
	compile.c 
Log Message:

Re-allow 'import mod.submod as s', and change its meaning to what it should
mean; the same as 'from mod import submod as s'.



Index: compile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v
retrieving revision 2.136
retrieving revision 2.137
diff -C2 -r2.136 -r2.137
*** compile.c	2000/08/27 19:01:33	2.136
--- compile.c	2000/08/27 20:16:32	2.137
***************
*** 2355,2364 ****
  			com_push(c, 1);
  			if (NCH(subn) > 1) {
! 				if (strcmp(STR(CHILD(subn, 1)), "as") != 0 ||
! 				    NCH(CHILD(subn, 0)) > 1) {
  					com_error(c, PyExc_SyntaxError,
  						  "invalid syntax");
  					return;
  				}
  				com_addopname(c, STORE_NAME, CHILD(subn, 2));
  			} else
--- 2355,2367 ----
  			com_push(c, 1);
  			if (NCH(subn) > 1) {
! 				int j;
! 				if (strcmp(STR(CHILD(subn, 1)), "as") != 0) {
  					com_error(c, PyExc_SyntaxError,
  						  "invalid syntax");
  					return;
  				}
+ 				for (j=2 ; j < NCH(CHILD(subn, 0)); j += 2)
+ 					com_addopname(c, LOAD_ATTR,
+ 						      CHILD(CHILD(subn, 0), j));
  				com_addopname(c, STORE_NAME, CHILD(subn, 2));
  			} else