class slot evolution not handled correctly
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ZODB |
Confirmed
|
Low
|
Unassigned |
Bug Description
By default, a class may implement attributes in an instance dictionary or with slots. When we store an object wo slots, we just save a copy of the instance dict (after removing special variables). When we save an object that has slots, we save tuple with a copy of the instance dict (or None if there isn't one) and a dictionary of slot variables.
On load, we update the instance dict with the saved instance dict, if there was one, and set attributes for the slot data.
If we convert a class to use slots only, the load of old data will fail because there's no instance dictionary to load the old instance dictionarty into.
If we convert some, but not all data to use slots, the old data will be loaded into the instance dictionary and ignored.
To handle this correctly, we should check the slot list and do setattrs for attributes found in the slot list and stick everything else in the instance dict.
I strongly suspect that using slots in persistent-object classes is missguided at best.
Changed in zodb: | |
status: | New → Confirmed |
importance: | Undecided → Low |