Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix wrong type annotation #380

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
Jul 21, 2016
Merged

Fix wrong type annotation #380

merged 1 commit into from
Jul 21, 2016

Conversation

fabianhjr
Copy link
Contributor

Fix wrong type annotation, floor should be float -> int

@@ -29,7 +29,7 @@ def exp(x: float) -> float: ...
def expm1(x: float) -> float: ...
def fabs(x: float) -> float: ...
def factorial(x: int) -> int: ...
def floor(x: float) -> float: ...
def floor(x: float) -> int: ...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually it's float in PY2 and int in PY3...

Copy link
Contributor Author

@fabianhjr fabianhjr Jul 21, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:| weird, messed up then. Should I just copy this file to 3/ and change it there?

EDIT: Ok, so is it ok if I make a new math.pyi in 3/ with only this floor difference? Or do I need to bring in everything?

@gvanrossum
Copy link
Member

You can use a check for sys.version_info. (Though beware that mypy doesn't support those yet (python/mypy#698).

@fabianhjr
Copy link
Contributor Author

fabianhjr commented Jul 21, 2016

Hey @gvanrossum, I did go around checking for that; the issue with sys.versio_info is that it won't pass the tests since floor would need the same signature in both python2.x and python3.x;

So I went ahead and split the file in two.

@gvanrossum
Copy link
Member

gvanrossum commented Jul 21, 2016 via email

@fabianhjr
Copy link
Contributor Author

Ok, will do.

On Wed, Jul 20, 2016 at 11:45 PM, Guido van Rossum <[email protected]

wrote:

You can put # type: ignore on it to make the tests pass. Then we can take
that out when mypy implements version checking. Seems better than splitting
up the file.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#380 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AASjGTekCpMH5Ya3x4TRLoyWBJRIRcnjks5qXvlpgaJpZM4JRZuq
.

@gvanrossum
Copy link
Member

gvanrossum commented Jul 21, 2016 via email

@matthiaskramm
Copy link
Contributor

We have a fix for that in pytype, as well. I'm the process of exporting it.

@gvanrossum
Copy link
Member

gvanrossum commented Jul 21, 2016 via email

@matthiaskramm
Copy link
Contributor

Will do. Just waiting for the export to finish. (Exporting pytype takes a few hours, unfortunately)

@matthiaskramm
Copy link
Contributor

Closing and reopening, to (try to) force a Travis re-run.

@matthiaskramm matthiaskramm reopened this Jul 21, 2016
@matthiaskramm matthiaskramm merged commit d787dbe into python:master Jul 21, 2016
@fabianhjr fabianhjr deleted the fabianhjr-patch-math-floor branch July 21, 2016 18:08
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