Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Aug 17, 2020

Conversation

miss-islington
Copy link
Contributor

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

  • 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 [email protected]

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 <[email protected]>
@pablogsal
Copy link
Member

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

@miss-islington
Copy link
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants