Skip to content

Commit ba774f5

Browse files
committed
Merge PR #3310
2 parents 859d260 + e7a1a6b commit ba774f5

30 files changed

+255
-60
lines changed

RELEASE.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ pandas 0.11.0
295295
- DataFrame where with a datetimelike incorrectly selecting (GH3311_)
296296
- Ensure index casts work even in Int64Index
297297
- Fix set_index segfault when passing MultiIndex (GH3308_)
298+
- Ensure pickles created in py2 can be read in py3
298299

299300
.. _GH3294: https://github.com/pydata/pandas/issues/3294
300301
.. _GH622: https://github.com/pydata/pandas/issues/622

pandas/core/common.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,12 +1575,12 @@ def load(path):
15751575
-------
15761576
unpickled : type of object stored in file
15771577
"""
1578-
f = open(path, 'rb')
15791578
try:
1580-
return pickle.load(f)
1581-
finally:
1582-
f.close()
1583-
1579+
with open(path,'rb') as fh:
1580+
return pickle.load(fh)
1581+
except:
1582+
with open(path,'rb') as fh:
1583+
return pickle.load(fh, encoding='latin1')
15841584

15851585
class UTF8Recoder:
15861586
"""
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)