Skip to content
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

Make it possible to use inherited indexers #1248

Merged
merged 1 commit into from
Oct 8, 2020

Conversation

danabr
Copy link
Contributor

@danabr danabr commented Oct 7, 2020

What does this implement/fix? Explain your changes.

If a class A had indexer, and class B derived from it, Python.NET would
not consider class B to have any indexer.

Does this close any currently open issues?

No

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

@codecov-io
Copy link

codecov-io commented Oct 7, 2020

Codecov Report

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

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1248   +/-   ##
=======================================
  Coverage   86.25%   86.25%           
=======================================
  Files           1        1           
  Lines         291      291           
=======================================
  Hits          251      251           
  Misses         40       40           
Flag Coverage Δ
#setup_linux 64.94% <ø> (ø)
#setup_windows 72.50% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


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 f808166...1a3d75d. Read the comment docs.

@lostmsu
Copy link
Member

lostmsu commented Oct 7, 2020

What about interfaces?

@danabr
Copy link
Contributor Author

danabr commented Oct 7, 2020

What about interfaces?

That is already handled by #1246. The calculation of whether something has an indexer or not is done the same way for classes and interfaces. It is all based on the implementation class.

@lostmsu
Copy link
Member

lostmsu commented Oct 7, 2020

@danabr just to clarify. So if I have interface IExtra: IIndexed with indexer defined in IIndexed, but not in IExtra, and in Python do extra = IExtra(extra_impl) (e.g. explicit cast to IExtra), I would be able to do extra[1234]?

If so, I think a test for that scenario should be added to test_indexer_accessed_through_interface introduced in your previous PR.

If a class A had indexer, and class B derived from it, Python.NET would
not consider class B to have any indexer.
@danabr danabr force-pushed the inherited-indexers branch from b40da05 to 1a3d75d Compare October 8, 2020 05:42
@danabr
Copy link
Contributor Author

danabr commented Oct 8, 2020

Yes. The requested test has been added.

@lostmsu lostmsu merged commit c79be84 into pythonnet:master Oct 8, 2020
@christabella
Copy link
Contributor

This closes #256

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.

4 participants