Skip to content

fix: preserve user-declared __slots__ on the generated class - #1645

Open
kevindurant735rocket-creator wants to merge 1 commit into
python-attrs:mainfrom
kevindurant735rocket-creator:fix-1637-preserve-declared-slots
Open

kevindurant735rocket-creator wants to merge 1 commit into
python-attrs:mainfrom
kevindurant735rocket-creator:fix-1637-preserve-declared-slots

Conversation

@kevindurant735rocket-creator

Copy link
Copy Markdown

Fixes #1637.

attrs previously discarded an explicitly declared __slots__ tuple when building the slots class, so names declared by the user were silently dropped (no attribute, no error). Honor the declared names and de-dup against inherited slots, keeping frozen/pickle behavior intact.

Evidence:

  • tests/test_slots.py: 67 passed (new cases cover mangle / pickle / frozen / de-dup boundaries)
  • full suite: 1414 passed (4 pre-existing unrelated failures reproduce on the base commit — environment, not this change)
  • changelog entry added per towncrier convention

Verified on master @ ee66e72.

attrs previously discarded an explicitly declared __slots__ tuple when
building the slots class, so names declared by the user were silently
dropped (no attribute, no error). Honor the declared names and de-dup
against inherited slots, keeping frozen/pickle behavior intact.

Fixes python-attrs#1637

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

slots declared on attrs-decorated class are ignored/lost

1 participant