[New-bugs-announce] [issue24596] Script globals in a GC cycle not finalized when exiting with SystemExit

Petr Viktorin report at bugs.python.org
Thu Jul 9 15:31:32 CEST 2015


New submission from Petr Viktorin:

When this program is invoked as a script (`python reproducer.py`), the __del__ is never called:

---

class ClassWithDel:
    def __del__(self):
        print('__del__ called')

a = ClassWithDel()
a.link = a

raise SystemExit(0)

---


Raising a different exception, moving the code to a function, importing the module, or invoking with -m (or even -c), causes __del__ to be called normally.

----------
components: Interpreter Core
messages: 246491
nosy: encukou
priority: normal
severity: normal
status: open
title: Script globals in a GC cycle not finalized when exiting with SystemExit
versions: Python 3.4, Python 3.5, Python 3.6

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


More information about the New-bugs-announce mailing list