title: Python pickle doesn't work with UserLists/UserDicts
body: <p>UserDicts and UserLists seem to work unstable with <code>pickle</code> module. How do I fix this bug:</p>
  
  <p><strong>test_pickle.py</strong></p>
  
  <pre><code>import pickle
  
  class UserList(list):
      pass
  
  class UserDict(dict):
      pass
  
  u = UserList([])
  for i in range(10):
      d = UserDict()
      d.u = u
      u.append(d)
  
  pickle.dump(u, open("ttt.pcl", 'wb'))
  </code></pre>
  
  <p>$ python test_pickle.py</p>
  
  <pre><code>  ... &lt;~300 traceback lines&gt;
    File "/usr/lib/python2.7/pickle.py", line 663, in _batch_setitems
      save(v)
    File "/usr/lib/python2.7/pickle.py", line 331, in save
      self.save_reduce(obj=obj, *rv)
    File "/usr/lib/python2.7/pickle.py", line 405, in save_reduce
      self.memoize(obj)
    File "/usr/lib/python2.7/pickle.py", line 244, in memoize
      assert id(obj) not in self.memo
  AssertionError
  </code></pre>
  
  <p>Now, if I increase the number of elements in UserList, it gets even "better":</p>
  
  <pre><code>import pickle
  
  class UserList(list):
      pass
  
  class UserDict(dict):
      pass
  
  u = UserList([])
  for i in range(100):
      d = UserDict()
      d.u = u
      u.append(d)
  
  pickle.dump(u, open("ttt.pcl", 'wb'))
  </code></pre>
  
  <p>$python test_pickle.py</p>
  
  <pre><code>... &lt;more lines than my terminal can handle&gt;
    File "/usr/lib/python2.7/pickle.py", line 649, in save_dict
      self._batch_setitems(obj.iteritems())
    File "/usr/lib/python2.7/pickle.py", line 663, in _batch_setitems
      save(v)
    File "/usr/lib/python2.7/pickle.py", line 306, in save
      rv = reduce(self.proto)
    File "/usr/lib/python2.7/copy_reg.py", line 71, in _reduce_ex
      state = base(self)
  RuntimeError: maximum recursion depth exceeded while calling a Python object
  </code></pre>