Skip to content

Type Graph/MultiGraph inherited methods with Self - #15453

Merged
srittau merged 1 commit into
python:mainfrom
albinoyoda:networkx-graphs-type-base-methods-with-self
Mar 2, 2026
Merged

Type Graph/MultiGraph inherited methods with Self#15453
srittau merged 1 commit into
python:mainfrom
albinoyoda:networkx-graphs-type-base-methods-with-self

Conversation

@albinoyoda

@albinoyoda albinoyoda commented Feb 22, 2026

Copy link
Copy Markdown
Contributor

Graph.subgraph() returntype is Graph, causing type-issues for inherited classes (DiGraph).

I also propose a fix for a similar method of MultiGraph (the copy method).

@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@albinoyoda

Copy link
Copy Markdown
Contributor Author

ping

@srittau srittau left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks!

@srittau
srittau merged commit b8b4b69 into python:main Mar 2, 2026
39 checks passed
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