I don't think the problem is in .expireAll(). What is going on, as I understand, is that .expireAll() clears the cache and as now there are only weak reference to the row, Python garbage-collects it immediately. After that Python is free to create another object at the same address. the solution would be either to check weak references or to hold a real reference, like this:
def test_cache(): setupClass(CacheTest) s = CacheTest(name='foo') obj_id = id(s) s_id = s.id assert CacheTest.get(s_id) is s assert not s.sqlmeta.expired CacheTest.sqlmeta.expireAll() assert s.sqlmeta.expired CacheTest.sqlmeta.expireAll() s1 = CacheTest.get(s_id) # We should have a new object: assert id(s1) != obj_id obj_id2 = id(s1) CacheTest._connection.expireAll() s2 = CacheTest.get(s_id) assert id(s2) != obj_id and id(s2) != obj_id2 (I have removed "del" statments and created s1 and s2 instead of s.) If I understand it right, the failure in test_cache() actually shows that your patch really works and helps to save memory! (-: Oleg. -- Oleg Broytmann http://phd.pp.ru/ [EMAIL PROTECTED] Programmers don't die, they just GOSUB without RETURN. ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss