- SingletonThreadPool has a size and does a cleanup pass, so that
only a given number of thread-local connections stay around (needed
for sqlite applications that dispose of threads en masse)
-- fixed small pickle bug with lazy loaders [ticket:265]
+- fixed small pickle bug(s) with lazy loaders [ticket:265] [ticket:267]
- fixed possible error in mysql reflection where certain versions
return an array instead of string for SHOW CREATE TABLE call
self[:] = []
def __getstate__(self):
- """implemented to allow pickling, since __obj is a weakref."""
- return {'key':self.key, 'obj':self.obj, 'data':self.data, 'attr':self.attr}
+ """implemented to allow pickling, since __obj is a weakref, also the InstrumentedAttribute has callables
+ attached to it"""
+ return {'key':self.key, 'obj':self.obj, 'data':self.data}
def __setstate__(self, d):
- """implemented to allow pickling, since __obj is a weakref."""
+ """implemented to allow pickling, since __obj is a weakref, also the InstrumentedAttribute has callables
+ attached to it"""
self.key = d['key']
self.__obj = weakref.ref(d['obj'])
self.data = d['data']
- self.attr = d['attr']
+ self.attr = getattr(d['obj'].__class__, self.key)
obj = property(lambda s:s.__obj())
# shouldnt be pickling callables at the class level
def somecallable(*args):
return None
- manager.register_attribute(MyTest, 'mt2', uselist = False, trackparent=True, callable_=somecallable)
+ manager.register_attribute(MyTest, 'mt2', uselist = True, trackparent=True, callable_=somecallable)
x = MyTest()
- x.mt2 = MyTest2()
+ x.mt2.append(MyTest2())
x.user_id=7
s = pickle.dumps(x)