Fix PSQL KeyValueStore implementation for python 2/3 compatibility#365
Fix PSQL KeyValueStore implementation for python 2/3 compatibility#365
Conversation
The python instance to psycopg2 binary object conversion was not operating correctly in python 3. This updates the method to be cross compatible as well as updates the tests to use cross compatible accessors.
|
PTAL @wphicks @KyleFromKitware |
| ``PostgresKeyValueStore`` in different python major versions. | ||
| """ | ||
|
|
||
| PICKLE_PROTOCOL_VER = -1 |
There was a problem hiding this comment.
Will Python 3 attempt to read objects that have been pickled in Python 2? The documentation makes it seem like this is the case, which would defeat the purpose of changing the protocol number.
There was a problem hiding this comment.
A) I just noticed that I didn't try using the fix_imports flag for python 3's pickle. I'll have to try that in my compatibility failures I was seeing.
B) A python 3 instance of PostgresKeyValueStore will attempt to read the data in the table and columns its pointed to, even if that data was written by a python 2 instance of PostgresKeyValueStore. I had tried using a pinned protocol version of 2 (since both python versions understand that version) but was still seeing compatibility issues. This may have been the correct thing to do when I try (A).
The python instance to psycopg2 binary object conversion was not
operating correctly in python 3. This updates the method to be cross
compatible as well as updates the tests to use cross compatible
accessors.