[New-bugs-announce] [issue23720] __del__() order is broken since 3.4.0

Alexey Kazantsev report at bugs.python.org
Fri Mar 20 13:56:26 CET 2015


New submission from Alexey Kazantsev:

Pythons prior to 3.4.0 print

Vector!
Device!

while >=3.4.0 print

Device!
Vector!

If we replace Main with Vector on line 21, the behavior becomes random: in 50% of all cases it prints the wrong sequence, in other 50% the right. Our team treats this as a bug for several reasons:

1) Objects should be destroyed in breadth first reference tree traversal order, starting from the root. There are no cycles. It is nonsense to have freed children in parent's destructor.

2) Our applications suffer very much from this bug. Real "Vector" holds GPGPU memory and real "Device" holds the context, and CUDA/OpenCL require the context to be freed the last. With CUDA, the invalid destructor call order leads to segmentation faults.

This may have something to deal with the implementation of PEP 442 (though in our case there no reference cycles at all).

----------
files: bug.py
messages: 238661
nosy: Alexey Kazantsev
priority: normal
severity: normal
status: open
title: __del__() order is broken since 3.4.0
type: behavior
versions: Python 3.4, Python 3.5
Added file: http://bugs.python.org/file38599/bug.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23720>
_______________________________________


More information about the New-bugs-announce mailing list