Skip to content

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

Merged
srittau merged 1 commit into
python:masterfrom
BvB93:math_index
Oct 29, 2021
Merged

srittau merged 1 commit into
python:masterfrom
BvB93:math_index

Conversation

@BvB93

@BvB93 BvB93 commented Oct 29, 2021

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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

Akuli commented Oct 29, 2021

Copy link
Copy Markdown
Collaborator

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