[Python-checkins] CVS: python/dist/src/Lib __future__.py,1.9.2.1,1.9.2.2

Guido van Rossum gvanrossum@users.sourceforge.net
Mon, 20 Aug 2001 12:10:37 -0700


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

Modified Files:
      Tag: r22a2-branch
	__future__.py 
Log Message:
Merge trunk changes into 2.2a2 release branch.

I've discovered another reason not to *require* the new module: new is
not allowed in restricted mode.  Without this patch, this means that
any import from __future__ would fail, and in turn e.g. "import types"
would fail.

I'm beginning to wonder if sticking the CO_ constants in __future__
was such a good idea...


Index: __future__.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/__future__.py,v
retrieving revision 1.9.2.1
retrieving revision 1.9.2.2
diff -C2 -d -r1.9.2.1 -r1.9.2.2
*** __future__.py	2001/08/19 05:14:11	1.9.2.1
--- __future__.py	2001/08/20 19:10:35	1.9.2.2
***************
*** 56,60 ****
  __all__ = ["all_feature_names"] + all_feature_names
  
! import new as _new  # for CO_xxx symbols
  
  class _Feature:
--- 56,66 ----
  __all__ = ["all_feature_names"] + all_feature_names
  
! try:
!     import new as _new  # for CO_xxx symbols
! except ImportError: # May happen during build
!     class _new:
!         CO_NESTED = 0x0010
!         CO_GENERATOR_ALLOWED = 0x1000
!         CO_FUTURE_DIVISION = 0x2000
  
  class _Feature: