You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
modulemd_defaults.profiles is declared as a dict, which is a mutable type. This is bad as it makes instances of ModulemdDefaultsUnit dangerous to hash or to use from threads.
It is a goal that the model classes are immutable wherever possible. For list fields, we achieved that by using frozen lists. Similarly, if we have dicts, those should be frozen dicts to keep instances immutable.
Issue Type
Bug Report
Steps to reproduce
Create a ModulemdDefaultsUnit with profiles={}
Change the contents of profiles
Actual results
Changing contents of profiles is possible. If the ModulemdDefaultsUnit was used in a set or as a dict key, bad things happen.
Expected results
Attempting to change contents of profiles causes an exception to be raised.
Additional Information
I think the best solution to this would be for 'profiles' not to be a raw dict at all but some properly modelled type, similarly as done for MaintenanceEntry, but I note this wouldn't be backwards-compatible. Profiles being a raw dict means one can't be confident the dict has the right structure or that it's not being abused.
The text was updated successfully, but these errors were encountered:
Summary
modulemd_defaults.profiles is declared as a dict, which is a mutable type. This is bad as it makes instances of ModulemdDefaultsUnit dangerous to hash or to use from threads.
It is a goal that the model classes are immutable wherever possible. For list fields, we achieved that by using frozen lists. Similarly, if we have dicts, those should be frozen dicts to keep instances immutable.
Issue Type
Steps to reproduce
Actual results
Changing contents of profiles is possible. If the ModulemdDefaultsUnit was used in a set or as a dict key, bad things happen.
Expected results
Attempting to change contents of profiles causes an exception to be raised.
Additional Information
I think the best solution to this would be for 'profiles' not to be a raw dict at all but some properly modelled type, similarly as done for MaintenanceEntry, but I note this wouldn't be backwards-compatible. Profiles being a raw dict means one can't be confident the dict has the right structure or that it's not being abused.
The text was updated successfully, but these errors were encountered: