Skip to content

[functools] Add __slots__#15464

Closed
donbarbos wants to merge 1 commit intopython:mainfrom
donbarbos:slots-functools
Closed

[functools] Add __slots__#15464
donbarbos wants to merge 1 commit intopython:mainfrom
donbarbos:slots-functools

Conversation

@donbarbos
Copy link
Contributor

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

Copy link
Collaborator

@brianschubert brianschubert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I don't think these actually have __slots__ at runtime. Both partial and _PlaceholderType are implemented in the _functools accelerator module, so the actual runtime types are C types which don't use __slots__:
https://github.com/python/cpython/blob/a7beca8ae3168f1bf191a6be5a2ee5a3009c88c2/Lib/functools.py#L438

>>> import functools
>>> functools.partial.__slots__
Traceback (most recent call last):
  File "<python-input-1>", line 1, in <module>
    functools.partial.__slots__
AttributeError: type object 'functools.partial' has no attribute '__slots__'. Did you mean '.__class__' instead of '.__slots__'?

@donbarbos donbarbos closed this Feb 26, 2026
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.

2 participants