Skip to content

Allow math functions to accept objects implementing the __index__ protocol #6211

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

Merged
merged 1 commit into from
Oct 29, 2021

Conversation

BvB93
Copy link
Contributor

@BvB93 BvB93 commented Oct 29, 2021

The various math functions generally allow objects that implements __float__ and/or __index__.
This PR ensures that this behavior is reflected in the math.pyi stub file.

@github-actions
Copy link
Contributor

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

@srittau srittau merged commit 05cc30b into python:master Oct 29, 2021
@BvB93 BvB93 deleted the math_index branch October 29, 2021 20:22
@Akuli
Copy link
Collaborator

Akuli commented Oct 29, 2021

A couple improvements could be made:

  • This doesn't work on Python 3.7. It is new in Python 3.8.
  • cmath needs updating too.

@Akuli Akuli mentioned this pull request Nov 12, 2021
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.

3 participants