[Python-checkins] python/dist/src/Python newcompile.c, 1.1.2.66, 1.1.2.67

nnorwitz at projects.sourceforge.net nnorwitz at projects.sourceforge.net
Tue Jan 27 14:40:20 EST 2004


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

Modified Files:
      Tag: ast-branch
	newcompile.c 
Log Message:
fix dir()/vars()/co_varnames so they contain local variables

Index: newcompile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v
retrieving revision 1.1.2.66
retrieving revision 1.1.2.67
diff -C2 -d -r1.1.2.66 -r1.1.2.67
*** newcompile.c	27 Jan 2004 19:14:33 -0000	1.1.2.66
--- newcompile.c	27 Jan 2004 19:40:18 -0000	1.1.2.67
***************
*** 36,42 ****
       #: doing from __future__ import division doesn't work 
          doesn't output BINARY_TRUE_DIVISION
!      #: vars() doesn't return local variables
!      #: co_names & co_varnames don't contain the correct names
!              u_names & u_varnames are not used properly
       #: doc strings at class scope are POPed, not stored
          In interactive mode, they are printed. :-)
--- 36,40 ----
       #: 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
       #: doc strings at class scope are POPed, not stored
          In interactive mode, they are printed. :-)
***************
*** 2651,2660 ****
  
  	consts = dict_keys_inorder(c->u->u_consts, 0);
- 	if (!consts)
- 		goto error;
  	names = dict_keys_inorder(c->u->u_names, 0);
! 	if (!names)
  		goto error;
- 	varnames = PySequence_Tuple(c->u->u_ste->ste_varnames);
          freevars = PySequence_Tuple(c->u->u_freevars);
          cellvars = PySequence_Tuple(c->u->u_cellvars);
--- 2649,2656 ----
  
  	consts = dict_keys_inorder(c->u->u_consts, 0);
  	names = dict_keys_inorder(c->u->u_names, 0);
! 	varnames = dict_keys_inorder(c->u->u_varnames, 0);
! 	if (!consts || !names || !varnames)
  		goto error;
          freevars = PySequence_Tuple(c->u->u_freevars);
          cellvars = PySequence_Tuple(c->u->u_cellvars);




More information about the Python-checkins mailing list