Content-Length: 295245 | pFad | https://github.com/python/cpython/issues/105936

26 dataclasses: frozen dataclasses with slots' `__setattr__` and `__delattr__` does not work. · Issue #105936 · python/cpython · GitHub
Skip to content

dataclasses: frozen dataclasses with slots' __setattr__ and __delattr__ does not work. #105936

@avboag

Description

@avboag

Bug report

The check in frozen dataclasses' __setattr__ and __delattr__ does not work when slots=True:

@dataclass(frozen=True, slots=True)
class C:
    i: int

C(10).j = 5

crashes with

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 5, in __setattr__
TypeError: super(type, obj): obj must be an instance or subtype of type

instead of raising a FrozenInstanceError.

Likewise,

@dataclass(frozen=True, slots=True)
class C:
    i: int

class D(C):
    pass

D(10).j = 5

crashes with the same error instead of working.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://github.com/python/cpython/issues/105936

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy