[Python-checkins] python/dist/src/Python future.c, 2.12.2.5, 2.12.2.6 newcompile.c, 1.1.2.81, 1.1.2.82 pythonrun.c, 2.161.2.10, 2.161.2.11

nnorwitz at users.sourceforge.net nnorwitz at users.sourceforge.net
Sun Mar 21 14:34:13 EST 2004


Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6528/Python

Modified Files:
      Tag: ast-branch
	future.c newcompile.c pythonrun.c 
Log Message:
get future division working

Index: future.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/future.c,v
retrieving revision 2.12.2.5
retrieving revision 2.12.2.6
diff -C2 -d -r2.12.2.5 -r2.12.2.6
*** future.c	26 Jan 2004 14:38:58 -0000	2.12.2.5
--- future.c	21 Mar 2004 19:34:11 -0000	2.12.2.6
***************
*** 59,63 ****
  	}
  
! 	if (mod->kind != Module_kind) /* XXX */
  		return 1;
  	for (i = 0; i < asdl_seq_LEN(mod->v.Module.body); i++) {
--- 59,63 ----
  	}
  
! 	if (!(mod->kind == Module_kind || mod->kind == Interactive_kind))
  		return 1;
  	for (i = 0; i < asdl_seq_LEN(mod->v.Module.body); i++) {

Index: newcompile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v
retrieving revision 1.1.2.81
retrieving revision 1.1.2.82
diff -C2 -d -r1.1.2.81 -r1.1.2.82
*** newcompile.c	21 Mar 2004 18:59:27 -0000	1.1.2.81
--- newcompile.c	21 Mar 2004 19:34:11 -0000	1.1.2.82
***************
*** 33,38 ****
     Invalid behaviour:
       #: Ellipsis isn't handled properly
-      #: doing from __future__ import division doesn't work 
-         doesn't output BINARY_TRUE_DIVISION
       #: co_names doesn't contain locals, only globals, co_varnames may work
       #: ref leaks in interpreter when press return on empty line
--- 33,36 ----
***************
*** 212,215 ****
--- 210,215 ----
  	struct compiler c;
  	PyCodeObject *co = NULL;
+         PyCompilerFlags local_flags;
+         int merged;
  
          if (!__doc__) {
***************
*** 225,233 ****
  	if (c.c_future == NULL)
  		goto error;
! 	if (flags) {
! 		int merged = c.c_future->ff_features | flags->cf_flags;
! 		c.c_future->ff_features = merged;
! 		flags->cf_flags = merged;
! 	}
  
  	/* Trivial test of marshal code for now. */
--- 225,236 ----
  	if (c.c_future == NULL)
  		goto error;
! 	if (!flags) {
!             local_flags.cf_flags = 0;
!             flags = &local_flags;
!         }
!         merged = c.c_future->ff_features | flags->cf_flags;
!         c.c_future->ff_features = merged;
!         flags->cf_flags = merged;
!         c.c_flags = flags;
  
  	/* Trivial test of marshal code for now. */
***************
*** 2733,2736 ****
--- 2736,2741 ----
  	if (ste->ste_generator)
  		flags |= CO_GENERATOR;
+         if (c->c_flags->cf_flags & CO_FUTURE_DIVISION)
+                 flags |= CO_FUTURE_DIVISION;
  	n = PyDict_Size(c->u->u_freevars);
  	if (n < 0)

Index: pythonrun.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v
retrieving revision 2.161.2.10
retrieving revision 2.161.2.11
diff -C2 -d -r2.161.2.10 -r2.161.2.11
*** pythonrun.c	20 Mar 2004 21:28:22 -0000	2.161.2.10
--- pythonrun.c	21 Mar 2004 19:34:11 -0000	2.161.2.11
***************
*** 1146,1156 ****
  Py_SymtableString(const char *str, const char *filename, int start)
  {
- 	PyCompilerFlags local_flags;
  	mod_ty mod;
  	struct symtable *st;
  
! 	local_flags.cf_flags = 0; /* XXX flags? */
! 
! 	mod = PyParser_ASTFromString(str, filename, start, &local_flags);
  	if (mod == NULL)
  		return NULL;
--- 1146,1153 ----
  Py_SymtableString(const char *str, const char *filename, int start)
  {
  	mod_ty mod;
  	struct symtable *st;
  
! 	mod = PyParser_ASTFromString(str, filename, start, NULL);
  	if (mod == NULL)
  		return NULL;
***************
*** 1182,1186 ****
  	node *n;
  	perrdetail err;
- 	fprintf(stderr, "filename=%s\n", filename);
  	n = PyParser_ParseFileFlags(fp, filename, &_PyParser_Grammar, start, 
  				    ps1, ps2, &err, PARSER_FLAGS(flags));
--- 1179,1182 ----




More information about the Python-checkins mailing list