mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge class dict with parent dict when creating meta attributes
In some situations, where the Base class defines an Attribute, the BaseMeta class doesn't properly see the _get_parent_attribute or _get_attr_<whatever> methods because of multiple layers of subclasses (ie. Handler, which subclasses Task). This addresses that by merging the __dict__ of the parent with the current classes __dict__ meaning all future iterations see available special methods. Fixes #18378
This commit is contained in:
parent
912d6ed8cc
commit
4794b5da45
1 changed files with 3 additions and 1 deletions
|
@ -131,7 +131,9 @@ class BaseMeta(type):
|
|||
for parent in parents:
|
||||
if hasattr(parent, '__dict__'):
|
||||
_create_attrs(parent.__dict__, dst_dict)
|
||||
_process_parents(parent.__bases__, dst_dict)
|
||||
new_dst_dict = parent.__dict__.copy()
|
||||
new_dst_dict.update(dst_dict)
|
||||
_process_parents(parent.__bases__, new_dst_dict)
|
||||
|
||||
# create some additional class attributes
|
||||
dct['_attributes'] = dict()
|
||||
|
|
Loading…
Reference in a new issue