dataclass(slots=True) fails if method has an empty `__class__` cell
Bug report
Bug description:
On Python 3.14, this code:
def maker(): if False: __class__ = 42 def method(self): return __class__ return method from dataclasses import dataclass @dataclass(slots=True) class X: a: int meth = maker()
Fails with ValueError: Cell is empty, because some dataclasses machinery for updating the __class__ cell doesn't reckon with the possibility that the cell may be empty.
CPython versions tested on:
3.14, CPython main branch
Operating systems tested on:
macOS