Skip to content

stubtest should warn about missing __del__ #16414

Closed

Description

@JelleZijlstra

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.

Activity

  1. hauntsaninja commented on Nov 6, 2023

    @hauntsaninja
    Collaborator
  2. AlexWaygood commented on Nov 6, 2023

    @AlexWaygood
    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

  3. added a commit that references this issue on Nov 11, 2023
    c96d1ac
  4. added a commit that references this issue on Nov 11, 2023
    f7a0530
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions