Skip to content

[3.9] bpo-41568: Fix refleaks in zoneinfo subclasses (GH-21907) - #21912

Merged
miss-islington merged 1 commit into
python:3.9from
miss-islington:backport-c3dd7e4-3.9
Aug 17, 2020
Merged

miss-islington merged 1 commit into
python:3.9from
miss-islington:backport-c3dd7e4-3.9

Conversation

@miss-islington

@miss-islington miss-islington commented Aug 17, 2020 •

Copy link
Copy Markdown
Contributor
  • 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).
(cherry picked from commit c3dd7e4)

Co-authored-by: Paul Ganssle paul@ganssle.io

https://bugs.python.org/issue41568

* 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).
(cherry picked from commit c3dd7e4)

Co-authored-by: Paul Ganssle <paul@ganssle.io>
@pablogsal

Copy link
Copy Markdown
Member

@ambv This should go in the rc2 if that is possible :)

@miss-islington

Copy link
Copy Markdown
Contributor Author

@pganssle and @pablogsal: Status check is done, and it's a success ✅ .

@miss-islington
miss-islington merged commit e3cafeb into python:3.9 Aug 17, 2020
@miss-islington
miss-islington deleted the backport-c3dd7e4-3.9 branch August 17, 2020 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

5 participants