[Python-checkins] python/dist/src/Lib copy.py,1.22.10.4,1.22.10.5

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Mon, 12 Aug 2002 13:21:45 -0700


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

Modified Files:
      Tag: release22-maint
	copy.py 
Log Message:
Backport:

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.22.10.4
retrieving revision 1.22.10.5
diff -C2 -d -r1.22.10.4 -r1.22.10.5
*** copy.py	10 Jun 2002 21:37:00 -0000	1.22.10.4
--- copy.py	12 Aug 2002 20:21:43 -0000	1.22.10.5
***************
*** 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 ----