Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-318

Cannot Pickle SON objects under protocol 2

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.2
    • Affects Version/s: 2.1.1
    • Component/s: None
    • None

      Simple test case:

          def test_SON(self):
      
              simple_son = SON([])
              complex_son = SON([('son', simple_son), ('list', [simple_son, simple_son])])
      
              def test_pickling(p):
                  pickled = pickle.loads(pickle.dumps(complex_son, protocol=p))
                  self.assertEquals(pickled['son'], pickled['list'][0])
                  self.assertEquals(pickled['son'], pickled['list'][1])
      
      
              for protocol in [0, 1, 2, -1]:
                  test_pickling(protocol)
      
      

            Assignee:
            ross@mongodb.com Ross Lawley
            Reporter:
            ross@mongodb.com Ross Lawley
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: