with python2, pickle.dump use protocol 0 if not specified, protocol 0 is an ASCII protocol, current code works.
with python3, pickle.dump use protocol 3 if not specified, protocol 3 is a binary protocol, it requires the file to be written to is opened with "b", so python3 will complain that w is not opened with "b".
For better compatibility, force pickle.dump uses protocol 2, which is a binary protocol and open the pipe with "b", which will give us better performance.
with python2, pickle.dump use protocol 0 if not specified, protocol 0 is an ASCII protocol, current code works. with python3, pickle.dump use protocol 3 if not specified, protocol 3 is a binary protocol, it requires the file to be written to is opened with "b", so python3 will complain that w is not opened with "b".
For better compatibility, force pickle.dump uses protocol 2, which is a binary protocol and open the pipe with "b", which will give us better performance.