Object identity and misleading default __repr__
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ZODB Browser |
Fix Released
|
Low
|
Unassigned |
Bug Description
I received a bug report via email where the reporter was confused by two links to the same persistent object having different titles (of the form '<package.
What was more confusing to me was seeing a list of references to different persistent objects all having the same representation:
['<package.
This happens because the same memory address is reused when we free one Persistent object and load the next one.
Idea: check if the object has a custom __repr__ (via obj.__repr_
'<%s.%s with oid %x>' % (obj.__
I haven't made up my mind if it make sense to hide the memory address of non-persistent objects. On the one hand, all non-persistent objects are different if they're loaded from different pickles. On the other hand, it's possible to have multiple references to the same persistent object within one pickle.
Changed in zodbbrowser: | |
status: | Triaged → Fix Committed |
milestone: | none → 0.10.3 |
Changed in zodbbrowser: | |
status: | Fix Committed → Fix Released |
The fix in 0.10.3 was bad. 0.10.4 will have a proper fix.