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

ReadPreference instances aren't copyable

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 3.0
    • 3.0.2
    • None
    • None
    • Fully Compatible

    Description

      Discovered while helping port django_mongodb_engine to PyMongo 3.

      >>> import copy
      >>> from pymongo import *
      >>> copy.copy(ReadPreference.SECONDARY)
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "/Users/emptysquare/.virtualenvs/official/mongo-python-driver/pymongo/read_preferences.py", line 116, in __repr__
          self.name, self.__tag_sets)
      AttributeError: _ServerMode__tag_sets

      I think the _ServerMode base class needs __getstate__ and __setstate__.

      Attachments

        Activity

          People

            jesse@mongodb.com A. Jesse Jiryu Davis
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: