# 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
|
b
|
|
| 115 | 115 | return True |
| 116 | 116 | |
| 117 | 117 | |
| 118 | | cdef object all_parents = [] #weakref.WeakKeyDictionary() |
| 119 | | |
| 120 | 118 | |
| 121 | 119 | cdef class Parent(category_object.CategoryObject): |
| 122 | 120 | """ |
| … |
… |
|
| 151 | 149 | self._initial_coerce_list = [] |
| 152 | 150 | self._initial_action_list = [] |
| 153 | 151 | self._initial_convert_list = [] |
| 154 | | all_parents.append(self) |
| 155 | | # try: |
| 156 | | # all_parents[self] = True # this is a weak reference |
| 157 | | # except: |
| 158 | | # print "couldn't weakref", type(self) |
| 159 | 152 | |
| 160 | 153 | cdef int init_coerce(self, bint warn=True) except -1: |
| 161 | 154 | if self._coerce_from_hash is None: |
| … |
… |
|
| 279 | 272 | mor = <map.Map>self.convert_map_from(R) |
| 280 | 273 | |
| 281 | 274 | if mor is not None: |
| 282 | | try: |
| 283 | | if no_extra_args: |
| 284 | | return mor._call_(x) |
| 285 | | else: |
| 286 | | return mor._call_with_args(x, args, kwds) |
| 287 | | except TypeError: |
| 288 | | self._convert_from_hash.pop(mor.domain(), None) |
| 289 | | for i from 0 <= i < len(self._convert_from_list): |
| 290 | | if self._convert_from_list[i] is mor: |
| 291 | | del self._convert_from_list[i] |
| 292 | | break |
| 293 | | raise |
| | 275 | if no_extra_args: |
| | 276 | return mor._call_(x) |
| | 277 | else: |
| | 278 | return mor._call_with_args(x, args, kwds) |
| 294 | 279 | |
| 295 | 280 | raise TypeError, "No conversion defined from %s to %s"%(R, self) |
| 296 | 281 | |