-
Notifications
You must be signed in to change notification settings - Fork 750
Added parameter validation to PyObject methods #1021
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
Conversation
fbd4621
to
3307496
Compare
Codecov Report
@@ Coverage Diff @@
## master #1021 +/- ##
=======================================
Coverage 86.71% 86.71%
=======================================
Files 1 1
Lines 301 301
=======================================
Hits 261 261
Misses 40 40
Continue to review full report at Codecov.
|
All reactions
Sorry, something went wrong.
@filmor any chance to look at this? This is a pretty light change. |
All reactions
Sorry, something went wrong.
src/runtime/pyobject.cs
Outdated
/// <summary> | ||
/// Gets the specified attribute. If attribute is not found, returns the fallback value. | ||
/// </summary> | ||
public PyObject GetAttrOrElse(string name, PyObject _default) |
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.
How much would it hurt to make this behaviour the default? We are using GetAttr
a lot, I think (even in this file).
Sorry, something went wrong.
All reactions
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.
@filmor I don't know, I don't have any legacy code :)
But that would be a breaking change in contract.
Sorry, something went wrong.
All reactions
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.
I decided to take this change out, so the rest could be merged.
Sorry, something went wrong.
All reactions
Almost completely fine, but I'm not quite sure about the |
All reactions
Sorry, something went wrong.
* added parameter validation to PyObject methods
filmor
Successfully merging this pull request may close these issues.
None yet
What does this implement/fix? Explain your changes.
This adds basic validations to input parameters of various
PyObject
methods, which should help in debugging code, that uses Python.NET.Also adds a few function overloads
Does this close any currently open issues?
No, but it reduces divergence with Lost Tech fork
Checklist
Check all those that are applicable and complete.
AUTHORS
CHANGELOG