Skip to content

Commit

Permalink
Many-to-many collection loading bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
kozlovsky committed Nov 6, 2018
1 parent 29bbf4a commit 65d4a41
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pony/orm/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2795,13 +2795,13 @@ def load(attr, obj, items=None):
else: d[obj] = {rentity._get_by_raw_pkval_(row) for row in cursor.fetchall()}
for obj2, items in iteritems(d):
setdata2 = obj2._vals_.get(attr)
if setdata2 is None: setdata2 = obj._vals_[attr] = SetData()
if setdata2 is None: setdata2 = obj2._vals_[attr] = SetData()
else:
phantoms = setdata2 - items
if setdata2.added: phantoms -= setdata2.added
if phantoms: throw(UnrepeatableReadError,
'Phantom object %s disappeared from collection %s.%s'
% (safe_repr(phantoms.pop()), safe_repr(obj), attr.name))
% (safe_repr(phantoms.pop()), safe_repr(obj2), attr.name))
items -= setdata2
if setdata2.removed: items -= setdata2.removed
setdata2 |= items
Expand Down

0 comments on commit 65d4a41

Please sign in to comment.