cpython/Lib/test/test_dataclasses
Jelle Zijlstra 6859b95cff
gh-135228: When @dataclass(slots=True) replaces a dataclass, make the original class collectible (take 2) (GH-137047)
Remove the `__dict__` and `__weakref__` descriptors from the original class when creating a dataclass from it.

An interesting hack, but more localized in scope than gh-135230.

This may be a breaking change if people intentionally keep the original class around
when using `@dataclass(slots=True)`, and then use `__dict__` or `__weakref__` on the
original class.


Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-08-12 13:16:54 +02:00
..
__init__.py gh-135228: When @dataclass(slots=True) replaces a dataclass, make the original class collectible (take 2) (GH-137047) 2025-08-12 13:16:54 +02:00
dataclass_module_1.py
dataclass_module_1_str.py gh-108303: Create Lib/test/test_dataclasses/ directory (#108978) 2023-09-06 15:54:16 +02:00
dataclass_module_2.py
dataclass_module_2_str.py
dataclass_textanno.py