Skip to content

int.__new__ needs a stub #2686

Closed
Closed

Description

@DarwinAwardWinner

It seems that int doesn't have a method stub for __new__, which causes mypy to complain on code that attempts to subclass int. Unfortunately, I'm not sure exactly how to write this stub. If someone can give me some guidance, I can try to write a pull request.

Activity

  1. sproshev commented on Dec 12, 2018

    @sproshev
    Contributor

    int.__new__ had been added in #1352 but then reverted in #1464

  2. DarwinAwardWinner commented on Dec 12, 2018

    @DarwinAwardWinner
    ContributorAuthor

    So I guess it's not possible to add a stub for int.__new__ without breaking other things? Does this mean I just need to use # type: ignore on the call to super(...).__new__() when subclassing int?

  3. Bhargavasomu commented on Jan 14, 2019

    @Bhargavasomu

    I am experiencing the same issue with bytes too.

  4. sproshev commented on Jan 14, 2019

    @sproshev
    Contributor
  5. added
    stubs: incompleteAnnotations or sub-modules missing from an existing package or module
    and removed on Sep 17, 2020
  6. hauntsaninja commented on Sep 30, 2020

    @hauntsaninja
    Collaborator

    Closed by #4555

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    stubs: incompleteAnnotations or sub-modules missing from an existing package or module

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions