lazr config Section objects should prevent directly setting attributes
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Launchpad itself |
Fix Released
|
High
|
Curtis Hovey |
Bug Description
The Section objects for the lazr config system have a __getattr__() method that exposes the the configuration items in that section.
It does not have a __setattr__() method though, so directly setting attributes on the object will add items to the section object's instance dictionary. At this point, __getattr__() will no longer be called for that item: the new value shadows whatever was previously there.
This causes even more problems when you push() a config overlay that changes the previous configuration item. This process involves copying the section objects, complete with whatever was in their instance dictionary. So it will also shadow any values that are supposedly stacked on top of it.
The problems caused by this are likely to occur a fair bit later than the original buggy code, making debugging difficult. For this reason, I think Section should have a __setattr__() method that disallows direct setting of attributes. This would make the error apparent at the point where the problem is introduced.
Changed in launchpad-foundations: | |
assignee: | nobody → sinzui-is |
milestone: | none → 2.1.11 |
status: | Confirmed → Fix Committed |
This means that will have to many call sites though. Let's do this post-1.2.6