-
-
Notifications
You must be signed in to change notification settings - Fork 374
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
Using cached_property
results in undesired references
#1220
Comments
Also tagging @diabolo-dan here, who contributed the caching mechanism 🙃 |
I agree that doesn't seem ideal. It seems like the problem is that the original class gets added to globals when calling We can avoid this by either:
I guess that the latter option would make more sense. I think there may also be a related issue if I've put up: With some possible fixes, though it seems like |
I'm excited to see that the latest
attrs
version23.2.0
now supports usingcached_property
in combination with slotted classes 🥇👍🏼 I was about to enable this feature in my code base but then noticed the following issue: the garbage collection step described here no longer seems to work. I haven't checked how exactly the use ofcached_property
was enabled, but the applied mechanism seems to keep some references to the original classes and thus messes with the garbage collector, which I think is an undesired side-effect.Here a minimal example to reproduce the issue:
With the
cached_property
decorator, this gives the following output:while removing it yields the desired result:
The text was updated successfully, but these errors were encountered: