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

Add BaseException.__new__ #12346

Merged
merged 4 commits into from
Jul 21, 2024
Merged

Add BaseException.__new__ #12346

merged 4 commits into from
Jul 21, 2024

Conversation

tomasr8
Copy link
Contributor

@tomasr8 tomasr8 commented Jul 15, 2024

This comment has been minimized.

@srittau
Copy link
Collaborator

srittau commented Jul 15, 2024

It seems that pyright does not like the mismatch between __init__ and __new__ in sub-classes of BaseException. I'm not sure what to do about that, to be honest. Considering that BaseException_new just ignores keyword arguments, we could try adding a kwds: Unused argument to BaseException.__new__.

@tomasr8
Copy link
Contributor Author

tomasr8 commented Jul 15, 2024

That seems to reduce the amount of errors but a lot of them still remain (I pushed the change so that you can see for yourself)

This comment has been minimized.

@srittau
Copy link
Collaborator

srittau commented Jul 16, 2024

I'm a bit unsure how to proceed here. The stubs now seem to match the implementation. I'm not sure why pyright complains.

@tomasr8
Copy link
Contributor Author

tomasr8 commented Jul 16, 2024

I'm as stumped as you are 😅

stdlib/builtins.pyi Outdated Show resolved Hide resolved
Copy link
Contributor

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

Copy link
Collaborator

@srittau srittau left a comment

Choose a reason for hiding this comment

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

Thanks, @tomasr8 and @JelleZijlstra!

@srittau srittau merged commit 964d1d7 into python:main Jul 21, 2024
63 checks passed
@tomasr8 tomasr8 deleted the base-exception branch July 21, 2024 12:01
max-muoto pushed a commit to max-muoto/typeshed that referenced this pull request Jul 23, 2024
max-muoto pushed a commit to max-muoto/typeshed that referenced this pull request Sep 8, 2024
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.

BaseException lacks __new__()
3 participants