python3: unpickle tzinfo pickled with python2
Bug #1631989 reported by
ricolai
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
pytz |
Fix Released
|
High
|
Unassigned |
Bug Description
Hi,
Yes, pickle is not guaranteed to be cross-compatible between python versions, but it's so close !!
----------
Dump in python 2:
import pickle, pytz, datetime
with open("date.pickle", "wb") as fp:
pickle.
----------
Load in python 3:
import pickle
with open("date.pickle", "rb") as fp:
pickle.load(fp, encoding="bytes") # encoding="bytes" so that pickle can load old str
# fails with
# AttributeError: 'bytes' object has no attribute 'encode'
# because pytz.zone calls 'ascii(zone)' for something that is already in bytes
---------
pytz.ascii should not .encode 'bytes', that's it !
Thanks !
Changed in pytz: | |
status: | New → Triaged |
importance: | Undecided → High |
Changed in pytz: | |
status: | Triaged → Fix Committed |
Changed in pytz: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.