1. 28 Oct, 2016 1 commit
    • Kirill Smelkov's avatar
      BTreePy: Reset ._data unconditionally in .clear() · a643eb37
      Kirill Smelkov authored
      _Tree.clear() is called by _Tree.__setstate__() to reset both .data and
      ._firstbucket before actually proceeding with setting internal state
      with data loaded from database.
      
      However since 0718a45e (Use a Python __reduce__ method to make pickles
      match C.) ._data reset became conditional, first checking that ._data is
      not already empty.
      
      The .__setstate__() is often called with object being a ghost.  However
      ZODB was never promising to keep attributes alive on ghost objects and
      in fact attributes kept in __dict__ was always released, but attributes
      in slotted variables, probably due to overlook, started to be released
      on ghostification only recently:
      
          https://github.com/zopefoundation/persistent/commit/fe2219f4
          https://github.com/zopefoundation/persistent/pull/44
      
      and that change causes many BTree tests to fail in pure-python part, e.g.:
      
          ERROR: testGhostUnghost (BTrees.tests.test_IIBTree.IIBTreeTest)
          ----------------------------------------------------------------------
          Traceback (most recent call last):
            File "BTrees/tests/common.py", line 122, in testGhostUnghost
              self.assertEqual(list(root2[i].items()) , list(t.items()))
            File "/home/kirr/src/wendelin/z/persistent/persistent/persistence.py", line 266, in __getattribute__
              oga(self, '_p_activate')()
            File "/home/kirr/src/wendelin/z/persistent/persistent/persistence.py", line 386, in _p_activate
              jar.setstate(self)
            File "/home/kirr/src/wendelin/z/ZODB/src/ZODB/Connection.py", line 771, in setstate
              self._reader.setGhostState(obj, p)
            File "/home/kirr/src/wendelin/z/ZODB/src/ZODB/serialize.py", line 623, in setGhostState
              obj.__setstate__(state)
            File "BTrees/_base.py", line 1069, in __setstate__
              self.clear()
            File "BTrees/_base.py", line 818, in clear
              if self._data:
            File "/home/kirr/src/wendelin/z/persistent/persistent/persistence.py", line 268, in __getattribute__
              return oga(self, name)
          AttributeError: _data
      
      Via unconditionally resetting ._data in clear we can make the problem go away.
      
      After this patch with PURE_PYTHON=1 BTree testsuite is passing fully again.
      a643eb37
  2. 29 Sep, 2016 4 commits
  3. 04 Aug, 2016 1 commit
  4. 03 Aug, 2016 3 commits
  5. 18 May, 2016 3 commits
  6. 16 May, 2016 3 commits
  7. 15 May, 2016 1 commit
  8. 10 May, 2016 3 commits
  9. 20 Apr, 2016 1 commit
  10. 15 Apr, 2016 7 commits
  11. 14 Apr, 2016 8 commits
  12. 13 Apr, 2016 2 commits
  13. 11 Apr, 2016 1 commit
  14. 05 Apr, 2016 1 commit
  15. 29 Mar, 2016 1 commit