Message223426
I have no idea what was done to pickle for Python3, but this line works for me to unpickle a Python2 protocol 2 datetime pickle under Python3, where P2 is the Python2 pickle string:
pickle.loads(bytes(P2, encoding='latin1'), encoding='bytes')
For example,
>>> P2
'\x80\x02cdatetime\ndatetime\nq\x00U\n\x07Þ\x07\x12\r%%\x06á¸q\x01\x85q\x02Rq\x03.'
>>> pickle.loads(bytes(P2, encoding='latin1'), encoding='bytes')
datetime.datetime(2014, 7, 18, 13, 37, 37, 451000)
I don't understand the Python3 loads() docs with respect to the "encoding" and "errors" arguments, and can't guess whether this is the intended way. It seems at best highly obscure. But hard to argue with something that works ;-) |
|
Date |
User |
Action |
Args |
2014-07-18 18:53:01 | tim.peters | set | recipients:
+ tim.peters, belopolsky, pitrou, alexandre.vassalotti, eddygeek |
2014-07-18 18:53:01 | tim.peters | set | messageid: <1405709581.89.0.391162758655.issue22005@psf.upfronthosting.co.za> |
2014-07-18 18:53:01 | tim.peters | link | issue22005 messages |
2014-07-18 18:53:01 | tim.peters | create | |
|