Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-1175

Incompatible QSettings pickle protocol between python2 and python3

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Won't Do
    • P3: Somewhat important
    • None
    • 5.14.0
    • PySide
    • None
    • Linux/X11

    Description

      QSettings ini format (and possibly the other formats) makes use of the python stdlib pickle module to serialize and deserialize values in the settings file. In its current state, it uses the default behaviour of seralizing with a protocol version that is not compatible between python2 and python3.  A situation where this breaks down is a project that must currently support both python2 and python3 for likely the next 6 months to a year.

      Steps:

      1. Application is launched via python3, and QSettings syncs ini file to disk
      2. Application is launched via python2...
      ...
        File "/path/to/python/2.7.6/lib/python2.7/pickle.py", line 1382, in loads
          return Unpickler(file).load()
        File "/path/to/python/2.7.6/lib/python2.7/pickle.py", line 858, in load
          dispatch[key](self)
        File "/path/to/python/2.7.6/lib/python2.7/pickle.py", line 886, in load_proto
          raise ValueError, "unsupported pickle protocol: %d" % proto
      ValueError: unsupported pickle protocol: 3
      

      Back in 2013 the PyQt project added QtCore.pyqtSetPickleProtocol as a way to control the protocol version. With this, I could set the version to something like 2 which is compatible between python2/3.
      https://riverbankcomputing.com/news/pyqt-4101

      I don't see any equivalent capability in pyside. It would be very helpful if pyside could gain a similar api to control the pickle protocol version. Otherwise I can't see a way to use the same settings between python interpreters that don't support the same pickle protocol version.

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            crmaurei Cristian Maureira-Fredes
            justinisrael Justin Israel
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes