Details
-
Suggestion
-
Resolution: Won't Do
-
P3: Somewhat important
-
None
-
5.14.0
-
None
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:
- Application is launched via python3, and QSettings syncs ini file to disk
- 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.