=======
CHANGES
=======
+0.6.6
+=====
+- orm
+ - Fixed bug whereby a non-"mutable" attribute modified event
+ which occurred on an object that was clean except for
+ preceding mutable attribute changes would fail to strongly
+ reference itself in the identity map. This would cause the
+ object to be garbage collected, losing track of any changes
+ that weren't previously saved in the "mutable changes"
+ dictionary.
+
0.6.5
=====
- orm
__all__ = sorted(name for name, obj in locals().items()
if not (name.startswith('_') or inspect.ismodule(obj)))
-__version__ = '0.6.5'
+__version__ = '0.6.6'
del inspect, sys
previous = attr.copy(previous)
self.committed_state[attr.key] = previous
-
- if not self.modified:
+
+
+ # the "or not self.modified" is defensive at
+ # this point. The assertion below is expected
+ # to be True:
+ # assert self._strong_obj is None or self.modified
+
+ if self._strong_obj is None or not self.modified:
instance_dict = self._instance_dict()
if instance_dict:
instance_dict._modified.add(self)
gc.collect()
f1 = session.query(Foo).first()
assert not attributes.instance_state(f1).modified
+
+ @testing.resolve_artifact_names
+ def test_modified_after_mutable_change(self):
+ f1 = Foo(data = pickleable.Bar(4, 5), val=u'some val')
+ session = Session()
+ session.add(f1)
+ session.commit()
+ f1.data.x = 10
+ f1.data.y = 15
+ f1.val=u'some new val'
+
+ assert sa.orm.attributes.instance_state(f1)._strong_obj is not None
+
+ del f1
+ session.commit()
+ eq_(
+ session.query(Foo.val).all(),
+ [('some new val', )]
+ )
@testing.resolve_artifact_names
def test_unicode(self):