Skip to content

Fixed accessing partially overriden properties from Python #1650

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 1 commit into from
Jan 4, 2022

Conversation

lostmsu
Copy link
Member

@lostmsu lostmsu commented Dec 28, 2021

What does this implement/fix? Explain your changes.

.NET PropertyInfo.GetMethod would not return base non-overridden accessor for a partially overridden property (e.g. only setter overridden)

Because of that when constructing PropertyObject we scan base classes to find base accessor (if any).

Does this close any currently open issues?

fixes #1455

Any other comments?

This might have performance implications due to replacement of PropertyInfo.GetValue with getter.Invoke (not tested)

Also in the change

No need to serialize accessors - they can be reconstructed from the PropertyInfo

Checklist

Check all those that are applicable and complete.

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

@lostmsu lostmsu force-pushed the bugs/OverridenProperty branch 2 times, most recently from a41a153 to 84102cd Compare December 29, 2021 04:14
…etMethod would not return base non-overriden accessor for a partially overriden property

because of that when constructing PropertyObject we scan base classes to find base accessor (if any)

this might have performance implications due to replacement of PropertyInfo.GetValue with getter.Invoke (not tested)

fixes pythonnet#1455
@lostmsu lostmsu force-pushed the bugs/OverridenProperty branch from 84102cd to a07f00c Compare December 31, 2021 00:21
@lostmsu lostmsu merged commit fc31de1 into pythonnet:master Jan 4, 2022
@lostmsu lostmsu deleted the bugs/OverridenProperty branch January 4, 2022 16:42
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.

.NET property not accessible in derived classes where only the setter or the getter has been overridden
1 participant