FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-105936: Fix frozen dataclasses with slots' `__setattr__` and `__delattr_` by avboag · Pull Request #105937 · python/cpython · GitHub

/ cpython Public
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
Prev Previous commit
Next Next commit
Typo fix.
  • Loading branch information
avboag committed Jun 20, 2023
commit 4bf0b7e9861bd4166bcfa11b41d0563ee9bb8d71
4 changes: 2 additions & 2 deletions Lib/dataclasses.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ def _repr_fn(fields, globals):
return _recursive_repr(fn)


def _frozen_get_del_attr(cls, fields, globals):
def _frozen_set_del_attr(cls, fields, globals):
locals = {'cls': cls,
'FrozenInstanceError': FrozenInstanceError}
condition = 'type(self) is cls'
Expand Down Expand Up @@ -1121,7 +1121,7 @@ def _process_class(cls, init, repr, eq, order, unsafe_hash, frozen,
'functools.total_ordering')

if frozen:
for fn in _frozen_get_del_attr(cls, field_list, globals):
for fn in _frozen_set_del_attr(cls, field_list, globals):
if _set_new_attribute(cls, fn.__name__, fn):
raise TypeError(f'Cannot overwrite attribute {fn.__name__} '
f'in class {cls.__name__}')
Expand Down

Back | FazBrowse Home | New Git URL