-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
bpo-29638: Fix spurious refleaks after typing is imported #469
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
bpo-29638: Fix spurious refleaks after typing is imported #469
Conversation
@ilevkivskyi, thanks for your PR! By analyzing the history of the files in this pull request, we identified @Haypo and @serhiy-storchaka to be potential reviewers. |
# These classes require special treatment because they do not appear | ||
# in direct subclasses of collections.abc classes | ||
abs_classes = list(abs_classes) + [t.ChainMap, t.Counter, t.DefaultDict] | ||
for abc in abs_classes: | ||
for obj in abc.__subclasses__() + [abc]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to proceed subclasses of typing.ChainMap etc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They do not have subclasses yet, but if in future they will have some, then yes we will need to process them.
(Now however we need to process subclasses of other classes in abs_classes
list)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a second thought I think it is better to have this, because e.g. Counter[int]
is a subclass of Counter
, and Counter[int]
is created in test_typing
.
Thanks for merging this! |
I see them in 3.5. |
Ah, sorry, you are right, they were backported to 3.5 :-) Then this code could be backported unmodified, I will make PRs |
Fixes http://bugs.python.org/issue29638
This adds three more caches to
refleak.py/clear_caches()
.