Skip to content

PyObject.GetAttr(string, PyObject _default) masks any exceptions #1036

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

Closed
lostmsu opened this issue Jan 31, 2020 · 1 comment · Fixed by #1578
Closed

PyObject.GetAttr(string, PyObject _default) masks any exceptions #1036

lostmsu opened this issue Jan 31, 2020 · 1 comment · Fixed by #1578
Assignees
Milestone

Comments

@lostmsu
Copy link
Member

lostmsu commented Jan 31, 2020

This method has bad semantics. Ideally, _default should only be returned when the object does not have an attribute with the specified name. In all other cases GetAttr should raise the PythonException explaining what went wrong instead of returning _default.

@lostmsu
Copy link
Member Author

lostmsu commented Jan 31, 2020

We can:

  • change this method to use proper semantics, which would be a breaking change
  • or deprecate it with [Obsolete], and make a new one with a different name and proper semantics

@lostmsu lostmsu added this to the 3.0.0 milestone Mar 9, 2020
lostmsu added a commit to losttech/pythonnet that referenced this issue Oct 1, 2021
lostmsu added a commit to losttech/pythonnet that referenced this issue Oct 1, 2021
lostmsu added a commit that referenced this issue Oct 1, 2021
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 a pull request may close this issue.

2 participants