Skip to content
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

Disable implicit conversion from PyFloat to uint64 #1362

Merged
merged 2 commits into from Jan 21, 2021

Conversation

tminka
Copy link
Contributor

@tminka tminka commented Jan 21, 2021

What does this implement/fix? Explain your changes.

Fixes an oversight in #1343 that allows PyFloat to continue being converted to uint64.

Does this close any currently open issues?

Fixes the test failures in #1361

Any other comments?

...

Checklist

Check all those that are applicable and complete.

  • Make sure to include one or more tests for your change
  • If an enhancement PR, please create docs and at best an example
  • Add yourself to AUTHORS
  • Updated the CHANGELOG

Comment on lines 702 to 704
if (Runtime.PyObject_TYPE(value) != Runtime.PyLongType)
{
op = Runtime.PyNumber_Long(value);
if (op == IntPtr.Zero)
{
goto convert_error;
}
goto type_error;
Copy link
Member

Choose a reason for hiding this comment

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

I think this can be skipped alltogether. https://docs.python.org/3.8/c-api/long.html#c.PyLong_AsUnsignedLongLong already checks the type.

@lostmsu lostmsu merged commit 7e7cbca into pythonnet:master Jan 21, 2021
@tminka tminka deleted the no-implicit-float-to-uint64 branch January 21, 2021 21:29
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.

None yet

2 participants