Title: PyFloats should not be implicitly rounded to integers · Issue #1342 · pythonnet/pythonnet · GitHub
Open Graph Title: PyFloats should not be implicitly rounded to integers · Issue #1342 · pythonnet/pythonnet
X Title: PyFloats should not be implicitly rounded to integers · Issue #1342 · pythonnet/pythonnet
Description: Environment Pythonnet version: Latest master Python version: 3.7.8 Operating System: Windows 10 64-bit .NET Runtime: Core 3.1 Details Incorrectly passing a float value to a method accepting an integer argument causes the float value to b...
Open Graph Description: Environment Pythonnet version: Latest master Python version: 3.7.8 Operating System: Windows 10 64-bit .NET Runtime: Core 3.1 Details Incorrectly passing a float value to a method accepting an inte...
X Description: Environment Pythonnet version: Latest master Python version: 3.7.8 Operating System: Windows 10 64-bit .NET Runtime: Core 3.1 Details Incorrectly passing a float value to a method accepting an inte...
Opengraph URL: https://github.com/pythonnet/pythonnet/issues/1342
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"PyFloats should not be implicitly rounded to integers","articleBody":"### Environment\r\n\r\n- Pythonnet version: [Latest master](https://github.com/pythonnet/pythonnet/commit/1f40564cbff0f109b6042973527b032be194b7e8)\r\n- Python version: 3.7.8\r\n- Operating System: Windows 10 64-bit\r\n- .NET Runtime: Core 3.1\r\n\r\n### Details\r\n\r\nIncorrectly passing a float value to a method accepting an integer argument causes the float value to be rounded. \r\n\r\n```python\r\nfrom Python.Test import MethodTest\r\nMethodTest.TestOverloadedNoObject(5.5)\r\n```\r\n\r\nSurprisingly, 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:\r\n\r\n```python\r\na = [1,2,3]\r\na[1.0]\r\nTypeError: list indices must be integers or slices, not float\r\n```","author":{"url":"https://github.com/tminka","@type":"Person","name":"tminka"},"datePublished":"2020-12-31T15:41:23.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/1342/pythonnet/issues/1342"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3d9df1da-e493-39f5-cd13-314971e25e5e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8604:51557:164E6A3:1DE5B5B:697067D4 |
| html-safe-nonce | 5f6382251f3a46d6a25eb153e4d1589e9890e25efa90cb115c396490749b0789 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NjA0OjUxNTU3OjE2NEU2QTM6MURFNUI1Qjo2OTcwNjdENCIsInZpc2l0b3JfaWQiOiI0Mjc1MjE3ODQ0MTQxMDU4MDA0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 3c1bb06220f743e315644063235748bb828ed7c0997c684466eb35d030b4dc3e |
| hovercard-subject-tag | issue:777066389 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/pythonnet/pythonnet/1342/issue_layout |
| twitter:image | https://opengraph.githubassets.com/00b2bfc6c321083f82e4635986eb5c75003bac0dcd0eeab2a42af0dd127227c6/pythonnet/pythonnet/issues/1342 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/00b2bfc6c321083f82e4635986eb5c75003bac0dcd0eeab2a42af0dd127227c6/pythonnet/pythonnet/issues/1342 |
| og:image:alt | Environment Pythonnet version: Latest master Python version: 3.7.8 Operating System: Windows 10 64-bit .NET Runtime: Core 3.1 Details Incorrectly passing a float value to a method accepting an inte... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tminka |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9920a62ba22d06470388e2904804fb7e5ec51c9e35f81784e9191394c74b2bd2 |
| turbo-cache-control | no-preview |
| go-import | github.com/pythonnet/pythonnet git https://github.com/pythonnet/pythonnet.git |
| octolytics-dimension-user_id | 6050430 |
| octolytics-dimension-user_login | pythonnet |
| octolytics-dimension-repository_id | 14748123 |
| octolytics-dimension-repository_nwo | pythonnet/pythonnet |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 14748123 |
| octolytics-dimension-repository_network_root_nwo | pythonnet/pythonnet |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7d6181066430cc06553c8396ca201e194ae33cb9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width