[Python-checkins] python/dist/src/Python compile.c, 2.234.4.8, 2.234.4.9

jhylton at users.sourceforge.net jhylton at users.sourceforge.net
Mon Sep 22 00:42:20 EDT 2003


Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1:/tmp/cvs-serv25029/Python

Modified Files:
      Tag: release22-maint
	compile.c 
Log Message:
Backport fix for SF808594: leak on lambda with duplicate arguments.


Index: compile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v
retrieving revision 2.234.4.8
retrieving revision 2.234.4.9
diff -C2 -d -r2.234.4.8 -r2.234.4.9
*** compile.c	22 May 2003 16:43:03 -0000	2.234.4.8
--- compile.c	22 Sep 2003 04:42:17 -0000	2.234.4.9
***************
*** 4550,4553 ****
--- 4550,4563 ----
  
  static int
+ symtable_error(struct symtable *st, int lineno)
+ {
+ 	if (lineno == 0)
+ 		lineno = st->st_cur->ste_lineno;
+ 	PyErr_SyntaxLocation(st->st_filename, lineno);
+ 	st->st_errors++;
+ 	return -1;
+ }
+ 
+ static int
  symtable_load_symbols(struct compiling *c)
  {
***************
*** 4613,4619 ****
  				PyErr_Format(PyExc_SyntaxError, LOCAL_GLOBAL,
  					     PyString_AS_STRING(name));
! 				PyErr_SyntaxLocation(st->st_filename, 
! 						   ste->ste_lineno);
! 				st->st_errors++;
  				goto fail;
  			}
--- 4623,4627 ----
  				PyErr_Format(PyExc_SyntaxError, LOCAL_GLOBAL,
  					     PyString_AS_STRING(name));
! 				symtable_error(st, 0);
  				goto fail;
  			}
***************
*** 4960,4966 ****
  		    PyErr_Format(PyExc_SyntaxError, DUPLICATE_ARGUMENT,
  				 PyString_AsString(name));
! 		    PyErr_SyntaxLocation(st->st_filename,
! 				       st->st_cur->ste_lineno);
! 		    return -1;
  	    }
  	    val |= flag;
--- 4968,4972 ----
  		    PyErr_Format(PyExc_SyntaxError, DUPLICATE_ARGUMENT,
  				 PyString_AsString(name));
! 		    return symtable_error(st, 0);
  	    }
  	    val |= flag;
***************
*** 5359,5365 ****
  				     "name '%.400s' is local and global",
  					     name);
! 				PyErr_SyntaxLocation(st->st_filename,
! 						   st->st_cur->ste_lineno);
! 				st->st_errors++;
  				return;
  			}
--- 5365,5369 ----
  				     "name '%.400s' is local and global",
  					     name);
! 				symtable_error(st, 0);
  				return;
  			}
***************
*** 5421,5427 ****
  				PyErr_SetString(PyExc_SyntaxError,
  						LATE_FUTURE);
!  				PyErr_SyntaxLocation(st->st_filename,
! 						   n->n_lineno);
! 				st->st_errors++;
  				return;
  			}
--- 5425,5429 ----
  				PyErr_SetString(PyExc_SyntaxError,
  						LATE_FUTURE);
! 				symtable_error(st, n->n_lineno);
  				return;
  			}
***************
*** 5516,5522 ****
  				PyErr_SetString(PyExc_SyntaxError, 
  						ASSIGN_DEBUG);
! 				PyErr_SyntaxLocation(st->st_filename,
! 						     n->n_lineno);
! 				st->st_errors++;
  			}
  			symtable_add_def(st, STR(tmp), DEF_LOCAL | def_flag);
--- 5518,5523 ----
  				PyErr_SetString(PyExc_SyntaxError, 
  						ASSIGN_DEBUG);
! 				symtable_error(st, n->n_lineno);
! 				return;
  			}
  			symtable_add_def(st, STR(tmp), DEF_LOCAL | def_flag);





More information about the Python-checkins mailing list