Skip to content

Do not copy __weakref__ from original _cls_dict#410

Merged
hynek merged 2 commits intopython-attrs:masterfrom
gmacon:issue-407
Jul 28, 2018
Merged

Do not copy __weakref__ from original _cls_dict#410
hynek merged 2 commits intopython-attrs:masterfrom
gmacon:issue-407

Conversation

@gmacon
Copy link
Copy Markdown
Contributor

@gmacon gmacon commented Jul 18, 2018

This fixes #407 as discussed.

Pull Request Check List

This is just a reminder about the most common mistakes. Please make sure that you tick all appropriate boxes. But please read our contribution guide at least once, it will save you unnecessary review cycles!

  • Added tests for changed code.
  • New features have been added to our Hypothesis testing strategy.
  • Changes or additions to public APIs are reflected in our type stubs (files ending in .pyi).
  • Updated documentation for changed code.
  • Documentation in .rst files is written using semantic newlines.
  • Changed/added classes/methods/functions have appropriate versionadded, versionchanged, or deprecated directives.
  • Changes (and possible deprecations) have news fragments in changelog.d.

If you have any questions to any of the points above, just submit and ask! This checklist is here to help you, not to deter you from contributing!

self._cls_dict["__weakref__"] holds a reference to self._cls, preventing
self._cls from being released after the new, slots-enabled class is
returned.

Fixes python-attrs#407
@hynek hynek requested a review from Tinche July 18, 2018 07:08
@hynek hynek added this to the 18.2 milestone Jul 22, 2018
Comment thread tests/test_make.py
pass

# The original C2 is in a reference cycle, so force a collect:
gc.collect()

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@hynek hynek removed the request for review from Tinche July 28, 2018 10:24
@hynek hynek merged commit 4c41099 into python-attrs:master Jul 28, 2018
@hynek
Copy link
Copy Markdown
Member

hynek commented Jul 28, 2018

Thanks George & Nate!

@gmacon gmacon deleted the issue-407 branch July 29, 2018 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Slots class holding a reference to the original version

3 participants