Skip to content

Disable implicit conversions that might lose information #1568

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 3 commits into from
Sep 27, 2021

Conversation

lostmsu
Copy link
Member

@lostmsu lostmsu commented Sep 23, 2021

What does this implement/fix? Explain your changes.

This removes the following conversions:
PyInt -> int32 (when trying to convert to object only)
.NET arrays and collections -> Python list (due to mutability)

Additionally, PyObject no longer implements IEnumerable<PyObject>, as not all python objects are iterable. Instead, a new class PyIterable is added.

Checklist

  • Make sure to include one or more tests for your change
  • Updated the CHANGELOG

@lostmsu lostmsu force-pushed the disable-auto-conversions branch from 631b019 to c97e5ab Compare September 23, 2021 19:05
@lostmsu lostmsu marked this pull request as ready for review September 23, 2021 20:43
@lostmsu lostmsu added this to the 3.0.0 milestone Sep 24, 2021
@lostmsu lostmsu force-pushed the disable-auto-conversions branch from 2e8cd3f to b2e6d4e Compare September 27, 2021 21:45
@lostmsu lostmsu merged commit 1ca0bdb into pythonnet:master Sep 27, 2021
@lostmsu lostmsu deleted the disable-auto-conversions branch September 27, 2021 21:52
Copy link
Member Author

@lostmsu lostmsu left a comment

Choose a reason for hiding this comment

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

A few minor isssues

{
if (setError)
{
Exceptions.SetError(ex.InnerException);
Copy link
Member Author

Choose a reason for hiding this comment

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

Should be just SetError(ex)

Comment on lines 363 to 364
return true;
}
// shouldn't happen
return false;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Fallback branch should be added.

lostmsu added a commit to losttech/pythonnet that referenced this pull request Sep 27, 2021
lostmsu added a commit to losttech/pythonnet that referenced this pull request Sep 27, 2021
lostmsu added a commit that referenced this pull request Sep 27, 2021
lostmsu added a commit to losttech/pythonnet that referenced this pull request Oct 2, 2021
… point types

arbitrary Python objects are no longer implicitly converted to .NET bool type

this is a continuation of pythonnet#1568
lostmsu added a commit to losttech/pythonnet that referenced this pull request Oct 2, 2021
… point types

arbitrary Python objects are no longer implicitly converted to .NET bool type

this is a continuation of pythonnet#1568
lostmsu added a commit to losttech/pythonnet that referenced this pull request Oct 2, 2021
… point types

arbitrary Python objects are no longer implicitly converted to .NET bool type

this is a continuation of pythonnet#1568
lostmsu added a commit to losttech/pythonnet that referenced this pull request Oct 2, 2021
… point types

arbitrary Python objects are no longer implicitly converted to .NET bool type

this is a continuation of pythonnet#1568
lostmsu added a commit to losttech/pythonnet that referenced this pull request Oct 2, 2021
… point types

arbitrary Python objects are no longer implicitly converted to .NET bool type

this is a continuation of pythonnet#1568
lostmsu added a commit that referenced this pull request Oct 5, 2021
… point types

arbitrary Python objects are no longer implicitly converted to .NET bool type

this is a continuation of #1568
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.

2 participants