Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore __slotnames__ #2584

Merged
merged 2 commits into from
Mar 29, 2025
Merged

Ignore __slotnames__ #2584

merged 2 commits into from
Mar 29, 2025

Conversation

adamchainz
Copy link
Contributor

@adamchainz adamchainz commented Mar 26, 2025

I have made things!

I noticed that we had a lot of __slotnames__ entries in our allow lists.

I found that this is added by Python's pickling/copying machinery:

https://github.com/python/cpython/blob/5abff6960b4aecb0d5c81c7482cf3faa74e1983d/Lib/copyreg.py#L112-L161

https://github.com/python/cpython/blob/77d2fd441320ca365c34e21c475d3878f3d5d833/Objects/typeobject.c#L7036-L7083

It seems like it can be safely ignored.

I wondered if this attribute could be ignored by default in stubtest, or even added to type or object in typeshed (as list[str]), but I am not sure how sensible that is. It doesn't always exist, only after a pickle.

Related issues

n/a

@adamchainz adamchainz requested a review from sobolevn March 26, 2025 13:55
Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Thanks!

@sobolevn sobolevn merged commit 04216c2 into master Mar 29, 2025
40 checks passed
@sobolevn sobolevn deleted the ignore_slotnames branch March 29, 2025 04:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants