[Python-checkins] CVS: python/dist/src/Lib weakref.py,1.1,1.2

Fred L. Drake fdrake@users.sourceforge.net
Fri, 02 Feb 2001 07:13:26 -0800


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

Modified Files:
	weakref.py 
Log Message:

WeakDictionary.items():  Do not allow (key,ref) pairs to leak out for
    dead references.


Index: weakref.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/weakref.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** weakref.py	2001/02/01 05:25:27	1.1
--- weakref.py	2001/02/02 15:13:24	1.2
***************
*** 68,77 ****
  
      def items(self):
!         L = self.data.items()
!         for i in range(len(L)):
              key, ref = L[i]
              o = ref()
              if o is not None:
!                 L[i] = key, o
          return L
  
--- 68,77 ----
  
      def items(self):
!         L = []
!         for key, ref in self.data.items():
              key, ref = L[i]
              o = ref()
              if o is not None:
!                 L.append((key, o))
          return L