Skip to content

Support generic parents in include_subclasses strategy #650

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

zhukovgreen
Copy link

Resolves #648

The strategy was using parent_cls.subclasses() to get the list of subclasses. In case of generics, this method is unavailable.

The fix applies sanitizing the cl and getting its origin class for getting a sublcasses tree.

The class itself remains generic in the tree.

Resolves python-attrs#648

The strategy was using parent_cls.__subclasses__() to get the
list of subclasses. In case of generics, this method
is unavailable.

The fix applies sanitizing the cl and getting its origin
class for getting the sublcasses tree.

The class itself remains generic in the tree.
@zhukovgreen
Copy link
Author

@Tinche sorry for bombing you: ) just would like to get rid form my custom implementation in one of our project. If you have time today - highly appreciated

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.

include_subclasses fails for classes with generics. AttributeError: __subclasses__. Did you mean: '__subclasscheck__'?
1 participant