◐ Shell
clean mode source ↗

Message 415303 - Python tracker

We have the same problem reported in attrs here in dataclasses and because it's not tested the way to manipulate __closure__ cells changes frequently.

My plan is to implement something similar to this into dataclasses: https://github.com/python-attrs/attrs/blob/5c040f30e3e4b3c9c0f27c8ac6ff13d604c1818c/src/attr/_make.py#L895-L916

Basically, when a new dataclass is created (with slots=True), look for references to the original class and fix them.

This fixes the problem reported to attrs in dataclasses and when we fix it and add some tests for it, the future behavior should be more stable.

What do you think?