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

TypeError: cannot create weak reference to 'Lock' object #331

Closed
henry232323 opened this issue Sep 26, 2017 · 1 comment
Closed

TypeError: cannot create weak reference to 'Lock' object #331

henry232323 opened this issue Sep 26, 2017 · 1 comment

Comments

@henry232323
Copy link

trio.Lock objects cannot be WeakReferenced! Is there a way we could get this fixed?

@njsmith
Copy link
Member

njsmith commented Sep 26, 2017

Huh, well, that's bizarre, and certainly not intentional. I suspect this is because they use __slots__ (via attr.s(slots=True, ...)), and probably affects a bunch of classes.

Ah-hah, yep: python-attrs/attrs#174

The simplest solution would be to go remove slots=True everywhere, since it's kind of a vague premature optimization in the first place...

njsmith added a commit to njsmith/trio that referenced this issue Sep 30, 2017
njsmith added a commit to njsmith/trio that referenced this issue Sep 30, 2017
Hopefully we can switch back to using slots=True at some point because
the memory savings are nice, but currently it breaks
weakrefs (python-triogh-331), and currently the supposed workaround breaks on
pypy:

  python-attrs/attrs#174 (comment)

(See also python-triogh-337 for an abortive attempt to apply that workaround.)

Fixes python-triogh-331
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

No branches or pull requests

2 participants