FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Added parameter validation to PyObject methods by lostmsu · Pull Request #1021 · pythonnet/pythonnet · GitHub

Repository navigation

Added parameter validation to PyObject methods - #1021

Merged
filmor merged 4 commits into
pythonnet:masterfrom
losttech:PR/PyObjectParamValidation
Feb 3, 2020
Merged

filmor merged 4 commits into
pythonnet:masterfrom
losttech:PR/PyObjectParamValidation

Conversation

lostmsu commented Dec 19, 2019

Copy link
Copy Markdown
Member

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.

  • 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

lostmsu force-pushed the PR/PyObjectParamValidation branch from fbd4621 to 3307496 Compare December 19, 2019 21:26

codecov-io commented Dec 20, 2019 •
edited
Loading

Copy link
Copy Markdown

Codecov Report

Merging #1021 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #1021   +/-   ##
=======================================
  Coverage   86.71%   86.71%           
=======================================
  Files           1        1           
  Lines         301      301           
=======================================
  Hits          261      261           
  Misses         40       40
Flag Coverage Δ
#setup_linux 65.44% <ø> (ø) ⬆️
#setup_windows 71.42% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3307496...91c7010. Read the comment docs.

lostmsu requested a review from filmor December 20, 2019 18:46

lostmsu commented Jan 9, 2020

Copy link
Copy Markdown
Member Author

@filmor any chance to look at this? This is a pretty light change.

Comment thread 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)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

How much would it hurt to make this behaviour the default? We are using GetAttr a lot, I think (even in this file).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@filmor I don't know, I don't have any legacy code :)
But that would be a breaking change in contract.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I decided to take this change out, so the rest could be merged.

filmor commented Jan 10, 2020

Copy link
Copy Markdown
Member

Almost completely fine, but I'm not quite sure about the GetAttr changes, in particular since GetAttr(PyObject) is unchanged AFAICT. Will have a closer look.

filmor self-requested a review January 22, 2020 07:54

lostmsu commented Jan 31, 2020 •
edited
Loading

Copy link
Copy Markdown
Member Author

@filmor I decided to take the GetAttrOrElse out for now so that the rest could be merged. Created issue #1036

filmor merged commit dbb88bc into pythonnet:master Feb 3, 2020
lostmsu deleted the PR/PyObjectParamValidation branch February 27, 2020 21:39
AlexCatarino pushed a commit to QuantConnect/pythonnet that referenced this pull request Jun 27, 2020
* added parameter validation to PyObject methods
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

3 participants


Back | FazBrowse Home | New Git URL