Skip to content

Improve error message for direct __init__ calls - #13183

Merged
hauntsaninja merged 2 commits into
python:masterfrom
hauntsaninja:call-init
Jul 19, 2022
Merged

hauntsaninja merged 2 commits into
python:masterfrom
hauntsaninja:call-init

Conversation

@hauntsaninja

Copy link
Copy Markdown
Collaborator

Resolves #13173

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

steam.py (https://github.com/Gobot1234/steam.py)
- steam/protobufs/struct_messages.py:33: error: Cannot access "__init__" directly  [misc]
+ steam/protobufs/struct_messages.py:33: error: Accessing "__init__" on an instance is unsound, since instance.__init__ could be from an incompatible subclass  [misc]

discord.py (https://github.com/Rapptz/discord.py)
- discord/ext/commands/core.py:534: error: Cannot access "__init__" directly
+ discord/ext/commands/core.py:534: error: Accessing "__init__" on an instance is unsound, since instance.__init__ could be from an incompatible subclass

@AlexWaygood AlexWaygood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@hauntsaninja
hauntsaninja merged commit 28258d0 into python:master Jul 19, 2022
@hauntsaninja
hauntsaninja deleted the call-init branch July 19, 2022 21:23
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.

Cannot access "__init__" directly

3 participants