[Python-checkins] python/dist/src/Lib ConfigParser.py,1.48,1.49

fdrake@users.sourceforge.net fdrake@users.sourceforge.net
Fri, 25 Oct 2002 13:41:32 -0700


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

Modified Files:
	ConfigParser.py 
Log Message:
According to the docs, __name__ is not exposed via the API except
indirectly via %(__name__)s.  Not sure why, but maintain the
documented behavior for the new items() method.

Be a little more efficient about how we compute the list of options in
the ConfigParser.items() method.


Index: ConfigParser.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/ConfigParser.py,v
retrieving revision 1.48
retrieving revision 1.49
diff -C2 -d -r1.48 -r1.49
*** ConfigParser.py	25 Oct 2002 18:08:18 -0000	1.48
--- ConfigParser.py	25 Oct 2002 20:41:30 -0000	1.49
***************
*** 275,280 ****
--- 275,283 ----
              if section != DEFAULTSECT:
                  raise NoSectionError(section)
+             d2 = {}
          d = self._defaults.copy()
          d.update(d2)
+         if "__name__" in d:
+             del d["__name__"]
          return d.items()
  
***************
*** 509,517 ****
          if vars:
              d.update(vars)
          if raw:
!             for option in self.options(section):
                  yield (option, d[option])
          else:
!             for option in self.options(section):
                  yield (option,
                         self._interpolate(section, option, d[option], d))
--- 512,523 ----
          if vars:
              d.update(vars)
+         options = d.keys()
+         if "__name__" in options:
+             options.remove("__name__")
          if raw:
!             for option in options:
                  yield (option, d[option])
          else:
!             for option in options:
                  yield (option,
                         self._interpolate(section, option, d[option], d))