Open
Description
Bug report
Bug description:
In the following:
import dataclasses
@dataclasses.dataclass(slots=True)
class Base:
def __init_subclass__(cls) -> None:
print(cls.__qualname__)
class Container:
@dataclasses.dataclass(slots=True)
class Dataclass(Base):
pass
I get:
Container.Dataclass
Dataclass
(I can handle the double-call, but the second call having incorrect __qualname__
is just really annoying 😂 )
To clarify the annoyance, the real world use case looks something like:
@dataclasses.dataclass(slots=True)
class Base:
def __init_subclass__(cls) -> None:
if "__slots__" not in cls.__dict__:
return # We're the unslotted class, wait until we're the slotted "real" one
... # Some code here relying on `__qualname__`
CPython versions tested on:
3.11
Operating systems tested on:
macOS