# HG changeset patch
# User Robert Bradshaw <robertwb@math.washington.edu>
# Date 1229458970 28800
# Node ID ce2185800a8419796e61e65c5338d5187cfd168a
# Parent  89aa530400af7cb9d91a7f19749b6f2ec5bc60a0
Fix memleak at ticket #4639 by removing old caching code.

diff -r 89aa530400af -r ce2185800a84 sage/structure/parent.pyx
--- a/sage/structure/parent.pyx	Mon Dec 01 23:45:08 2008 -0800
+++ b/sage/structure/parent.pyx	Tue Dec 16 12:22:50 2008 -0800
@@ -115,8 +115,6 @@
         return True
 
 
-cdef object all_parents = [] #weakref.WeakKeyDictionary()
-
 
 cdef class Parent(category_object.CategoryObject):
     """
@@ -151,11 +149,6 @@
         self._initial_coerce_list = []
         self._initial_action_list = []
         self._initial_convert_list = []
-        all_parents.append(self)
-#        try:
-#            all_parents[self] = True # this is a weak reference
-#        except:
-#            print "couldn't weakref", type(self)
         
     cdef int init_coerce(self, bint warn=True) except -1:
         if self._coerce_from_hash is None:
@@ -279,18 +272,10 @@
             mor = <map.Map>self.convert_map_from(R)
             
         if mor is not None:
-            try:
-                if no_extra_args:
-                    return mor._call_(x)
-                else:
-                    return mor._call_with_args(x, args, kwds)
-            except TypeError:
-                self._convert_from_hash.pop(mor.domain(), None)
-                for i from 0 <= i < len(self._convert_from_list):
-                    if self._convert_from_list[i] is mor:
-                        del self._convert_from_list[i]
-                        break
-                raise
+            if no_extra_args:
+                return mor._call_(x)
+            else:
+                return mor._call_with_args(x, args, kwds)
             
         raise TypeError, "No conversion defined from %s to %s"%(R, self)
         
