GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — dataclasses: frozen dataclasses with slots' `__setattr__` and `__delattr__` does not work. · Issue #105936 · python/cpython

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

New issue
Copy link
New issue
Copy link
Closed
Closed
dataclasses: frozen dataclasses with slots' __setattr__ and __delattr__ does not work.#105936
Copy link
Assignees
gpshead
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@avboag
avboag
opened on Jun 20, 2023
Issue body actions

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

  • gh-105936: Fix frozen dataclasses with slots' __setattr__ and __delattr_  #105937
  • gh-105936: Properly update closure cells for __setattr__ and __delattr__ in frozen dataclasses with slots #144021
  • [3.14] gh-105936: Properly update closure cells for __setattr__ and __delattr__ in frozen dataclasses with slots (GH-144021) #148469
  • [3.13] gh-105936: Properly update closure cells for __setattr__ and __delattr__ in frozen dataclasses with slots (GH-144021) #148476
Reacted by Abraham Murciano and Jaden Chuah

Activity

  1. avboag
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Jun 20, 2023
  2. iritkatriel
    added
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    on Nov 26, 2023
  3. gpshead
    added a commit that references this issue on Apr 12, 2026

    gh-105936: Properly update closure cells for `__setattr__` and `__del…

    8a398bf
  4. miss-islington
    added a commit that references this issue on Apr 12, 2026

    pythongh-105936: Properly update closure cells for `__setattr__` and …

    3fcd711
  5. gpshead
    added 3 commits that reference this issue on Apr 12, 2026

    pythongh-105936: Properly update closure cells for `__setattr__` and …

    6645d06

    [3.14] gh-105936: Properly update closure cells for `__setattr__` and…

    942d302

    [3.13] pythongh-105936: Properly update closure cells for `__setattr_…

    aa1e00f
  6. gpshead commented on Apr 13, 2026

    @gpshead
    gpshead
    on Apr 13, 2026
    Member
    More actions

    A 3.13 is up as a Draft PR because it requires more changes and backporting pieces of some other stuff that is already in 3.14 in order for it to work.

  7. prakashsellathurai
    added a commit that references this issue on Apr 13, 2026

    Revert "pythongh-105936: Properly update closure cells for `__setattr…

    cdcefcb
  8. ljfp
    added a commit that references this issue on Apr 25, 2026

    pythongh-105936: Properly update closure cells for `__setattr__` and …

    187221c
  9. gpshead
    added a commit that references this issue on Apr 26, 2026

    [3.13] gh-105936: Properly update closure cells for __setattr__ and _…

    9651429
  10. gpshead
    self-assigned this
    on Apr 26, 2026
  11. gpshead commented on Apr 26, 2026

    @gpshead
    gpshead
    on Apr 26, 2026
    Member
    More actions

    all merged. thanks for the report, contributions and reviews.

  12. gpshead
    closed this as completedon Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @gpshead
    gpshead

Labels

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

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.