-
Notifications
You must be signed in to change notification settings - Fork 747
PyFloats should not be implicitly rounded to integers #1342
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
Comments
lostmsu
added a commit
to losttech/pythonnet
that referenced
this issue
Dec 31, 2020
lostmsu
added a commit
to losttech/pythonnet
that referenced
this issue
Dec 31, 2020
3 tasks
lostmsu
added a commit
to losttech/pythonnet
that referenced
this issue
Dec 31, 2020
There is a similar problem with array indexing. The below test cases (extending def test_typed_array():
...
with pytest.raises(TypeError):
ob = Test.TypedArrayTest()
_ = ob.items[0.5]
with pytest.raises(TypeError):
ob = Test.TypedArrayTest()
ob.items[0.5] = Spam("0")
def test_multi_dimensional_array():
...
with pytest.raises(TypeError):
ob = Test.MultiDimensionalArrayTest()
_ = ob.items[0.5, 0]
with pytest.raises(TypeError):
ob = Test.MultiDimensionalArrayTest()
ob.items[0.5, 0] = 0 |
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Environment
Details
Incorrectly passing a float value to a method accepting an integer argument causes the float value to be rounded.
Surprisingly, the above code invokes the method with the integer 5. I expect this to raise an error instead, even if the value passed was
5.0
. I expect a method with an integer argument to behave like list indexing in Python, which refuses any float value:The text was updated successfully, but these errors were encountered: