Message299604
# collection module
dequeiter_dealloc doesn't call Untrack(), but it's safe because it only frees deque
and deque_dealloc calls Untrack()
dequeiter_dealloc(dequeiterobject *dio)
{
Py_XDECREF(dio->deque);
defdict_dealloc doesn't call Untrack(). And it can cause segfault:
from collections import defaultdict
import gc
class Evil:
def __del__(self):
gc.collect()
def __call__(self):
return 42
def main():
d = defaultdict(Evil())
for i in range(1000):
print(i)
main()
# _elementtree module
elementiter_dealloc() calls UnTrack(), but it seems too late?
static void
elementiter_dealloc(ElementIterObject *it)
{
Py_ssize_t i = it->parent_stack_used;
it->parent_stack_used = 0;
while (i--)
Py_XDECREF(it->parent_stack[i].parent);
PyMem_Free(it->parent_stack);
Py_XDECREF(it->sought_tag);
Py_XDECREF(it->root_element);
PyObject_GC_UnTrack(it);
PyObject_GC_Del(it);
} |
|
Date |
User |
Action |
Args |
2017-08-01 06:26:03 | methane | set | recipients:
+ methane, thehesiod |
2017-08-01 06:26:03 | methane | set | messageid: <1501568763.63.0.253927371032.issue31095@psf.upfronthosting.co.za> |
2017-08-01 06:26:03 | methane | link | issue31095 messages |
2017-08-01 06:26:03 | methane | create | |
|