[Python-checkins] CVS: python/dist/src/Include compile.h,2.34,2.35 pythonrun.h,2.45,2.46

Jeremy Hylton jhylton@users.sourceforge.net
Fri, 10 Aug 2001 14:38:07 -0700


Update of /cvsroot/python/python/dist/src/Include
In directory usw-pr-cvs1:/tmp/cvs-serv15547

Modified Files:
	compile.h pythonrun.h 
Log Message:
Refactor future feature handling

Replace individual slots in PyFutureFeatures with a single bitmask
with one field per feature.  The flags for this bitmask are the same
as the flags used in the co_flags slot of a code object.

    XXX This means we waste several bits, because they are used 
    for co_flags but have no meaning for future statements.  Don't
    think this is an issue.

Remove the NESTED_SCOPES_DEFAULT define and others.  Not sure what
they were for anyway.

Remove all the PyCF_xxx flags, but define PyCF_MASK in terms of the
CO_xxx flags that are relevant for this release.

Change definition of PyCompilerFlags so that cf_flags matches
co_flags.


Index: compile.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/compile.h,v
retrieving revision 2.34
retrieving revision 2.35
diff -C2 -d -r2.34 -r2.35
*** compile.h	2001/08/08 05:00:17	2.34
--- compile.h	2001/08/10 21:38:04	2.35
***************
*** 42,46 ****
     in effect when the code block was compiled. */
  #define CO_GENERATOR_ALLOWED    0x1000
- /* XXX Ditto for future division */
  #define CO_FUTURE_DIVISION    	0x2000
  
--- 42,45 ----
***************
*** 65,71 ****
      int ff_found_docstring;
      int ff_last_lineno;
!     int ff_nested_scopes;
!     int ff_generators;
!     int ff_division;
  } PyFutureFeatures;
  
--- 64,68 ----
      int ff_found_docstring;
      int ff_last_lineno;
!     int ff_features;
  } PyFutureFeatures;
  
***************
*** 74,84 ****
  					      PyCompilerFlags *);
  
- #define NESTED_SCOPES_DEFAULT 1
  #define FUTURE_NESTED_SCOPES "nested_scopes"
- 
- #define GENERATORS_DEFAULT 0
  #define FUTURE_GENERATORS "generators"
- 
- #define DIVISION_DEFAULT 0
  #define FUTURE_DIVISION "division"
  
--- 71,76 ----

Index: pythonrun.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/pythonrun.h,v
retrieving revision 2.45
retrieving revision 2.46
diff -C2 -d -r2.45 -r2.46
*** pythonrun.h	2001/08/08 05:00:17	2.45
--- pythonrun.h	2001/08/10 21:38:04	2.46
***************
*** 8,19 ****
  #endif
  
! /* These flags are named after the __future__ statements that introduced
!    them.  May not remain true for later additions, so fiddle this comment
!    accordingly then. */
! #define PyCF_NESTED_SCOPES	(0x00000001UL)
! #define PyCF_GENERATORS		(0x00000002UL)
! #define PyCF_DIVISION		(0x00000004UL)
  typedef struct {
! 	unsigned long cf_flags;  /* bitmask of PyCF_xxx flags */
  } PyCompilerFlags;
  
--- 8,14 ----
  #endif
  
! #define PyCF_MASK (CO_GENERATOR_ALLOWED | CO_FUTURE_DIVISION)
  typedef struct {
! 	int cf_flags;  /* bitmask of CO_xxx flags relevant to future */
  } PyCompilerFlags;