[New-bugs-announce] [issue33622] Fix and improve errors handling in the garbage collector

Serhiy Storchaka report at bugs.python.org
Wed May 23 13:41:20 EDT 2018


New submission from Serhiy Storchaka <storchaka+cpython at gmail.com>:

There are following bugs in the garbage collector.

* If the garbage collector fails to add an object with __del__ or referenced by an object with __del__ to gc.garbage (in handle_legacy_finalizers()), it leaks it and other not added objects with __del__ and referenced by them. They become no longer accessible by the garbage collector.

* PyGC_Collect() is not documented, but it is a public C API. And it can be called by user with an exception set. PyGC_Collect() then can either crash or just silent the exception. It is safer to safe possible exception and restore it after collecting.

* A pointer to released member can be used (compared with NULL) in invoke_gc_callback(). This is an undefined behavior.

----------
components: Interpreter Core
messages: 317431
nosy: pitrou, serhiy.storchaka, vstinner
priority: normal
severity: normal
status: open
title: Fix and improve errors handling in the garbage collector
type: behavior
versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33622>
_______________________________________


More information about the New-bugs-announce mailing list