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

stubtest should warn about missing __del__ #16414

Closed
JelleZijlstra opened this issue Nov 6, 2023 · 2 comments · Fixed by #16456
Closed

stubtest should warn about missing __del__ #16414

JelleZijlstra opened this issue Nov 6, 2023 · 2 comments · Fixed by #16456

Comments

@JelleZijlstra
Copy link
Member

Having __del__ present in stubs is useful for a few reasons:

  • A subclass that calls super().__del__() would see a false positive if __del__ is present in the base class at runtime but not in the stub
  • The documentation explicitly states that subclasses should call super().__del__() if they override a __del__ method. A type checker that wants to enforce this rule would need to know whether __del__ exists in the base class.

See discussion in python/typeshed#10984.

@hauntsaninja
Copy link
Collaborator

Who indeed cares ;-) https://github.com/python/mypy/pull/12203/files#diff-55639a1f38efeacbb10988649399037c13ad11e9c82890b453d98ea2bed9caf8R285

@AlexWaygood
Copy link
Member

Who indeed cares ;-) https://github.com/python/mypy/pull/12203/files#diff-55639a1f38efeacbb10988649399037c13ad11e9c82890b453d98ea2bed9caf8R285

I was but a child; I have Grown and Learned from my mistakes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants