-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Fix wrong type annotation #380
Conversation
@@ -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: ... |
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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?
You can use a check for sys.version_info. (Though beware that mypy doesn't support those yet (python/mypy#698). |
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. |
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.
|
Ok, will do. On Wed, Jul 20, 2016 at 11:45 PM, Guido van Rossum <[email protected]
|
Suggestion for the purpose failure: put the ... on the next line?
…--Guido (mobile)
|
We have a fix for that in pytype, as well. I'm the process of exporting it. |
@matthiaskramm, Can you re-run the failed test to confirm that it's fixed
and then merge?
|
Will do. Just waiting for the export to finish. (Exporting pytype takes a few hours, unfortunately) |
Closing and reopening, to (try to) force a Travis re-run. |
Fix wrong type annotation, floor should be float -> int