[Python-checkins] python/dist/src/Lib copy.py,1.28,1.29

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Mon, 12 Aug 2002 13:20:11 -0700


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

Modified Files:
	copy.py 
Log Message:
Make sure that *any* object whose id() is used as a memo key is kept
alive in the memo.  This fixes SF bug 592567.


Index: copy.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/copy.py,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** copy.py	10 Jun 2002 21:10:27 -0000	1.28
--- copy.py	12 Aug 2002 20:20:08 -0000	1.29
***************
*** 186,189 ****
--- 186,190 ----
          y = copierfunction(x, memo)
      memo[d] = y
+     _keep_alive(x, memo) # Make sure x lives at least as long as d
      return y
  
***************
*** 270,274 ****
      if hasattr(x, '__getinitargs__'):
          args = x.__getinitargs__()
-         _keep_alive(args, memo)
          args = deepcopy(args, memo)
          y = apply(x.__class__, args)
--- 271,274 ----
***************
*** 279,283 ****
      if hasattr(x, '__getstate__'):
          state = x.__getstate__()
-         _keep_alive(state, memo)
      else:
          state = x.__dict__
--- 279,282 ----