This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author methane
Recipients methane, thehesiod
Date 2017-08-01.06:26:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1501568763.63.0.253927371032.issue31095@psf.upfronthosting.co.za>
In-reply-to
Content
# 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);
        }
History
Date User Action Args
2017-08-01 06:26:03methanesetrecipients: + methane, thehesiod
2017-08-01 06:26:03methanesetmessageid: <1501568763.63.0.253927371032.issue31095@psf.upfronthosting.co.za>
2017-08-01 06:26:03methanelinkissue31095 messages
2017-08-01 06:26:03methanecreate