]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-41568: Fix refleaks in zoneinfo subclasses (GH-21907)
authorPaul Ganssle <paul@ganssle.io>
Mon, 17 Aug 2020 22:40:07 +0000 (18:40 -0400)
committerGitHub <noreply@github.com>
Mon, 17 Aug 2020 22:40:07 +0000 (23:40 +0100)
commitc3dd7e45cc5d36bbe2295c2840faabb5c75d83e4
treea92a7e7f05f129d762220707719b15665ed5f634
parent8aa163eea6b0fb4693f6c0a314d4f2ccada51d70
bpo-41568: Fix refleaks in zoneinfo subclasses (GH-21907)

* Fix refleak in C module __init_subclass__

This was leaking a reference to the weak cache dictionary for every
ZoneInfo subclass created.

* Fix refleak in ZoneInfo subclass's clear_cache

The previous version of the code accidentally cleared the global
ZONEINFO_STRONG_CACHE variable (and inducing `ZoneInfo` to create a new
strong cache) on calls to a subclass's `clear_cache()`. This would not
affect guaranteed behavior, but it's still not the right thing to do
(and it caused reference leaks).
Modules/_zoneinfo.c