Skip to content

Commit 4fba878

Browse files
jrebackjorisvandenbossche
authored andcommitted
COMPAT: pickle compat for Timestamp in py3.6
BUG: fix unorderable exception types in py3.6 closes pandas-dev#14689 (cherry picked from commit 2d8160e)
1 parent 645cf93 commit 4fba878

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

doc/source/whatsnew/v0.19.2.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ Bug Fixes
4242

4343

4444
- Compat with python 3.6 for pickling of some offsets (:issue:`14685`)
45-
- Compat with python 3.6 for some indexing exception types (:issue:`14684`)
45+
- Compat with python 3.6 for some indexing exception types (:issue:`14684`, :issue:`14689`)
4646
- Compat with python 3.6 for deprecation warnings in the test suite (:issue:`14681`)
47+
- Compat with python 3.6 for Timestamp pickles (:issue:`14689`)
4748

4849

4950

pandas/tslib.pyx

+6
Original file line numberDiff line numberDiff line change
@@ -1105,6 +1105,12 @@ cdef class _Timestamp(datetime):
11051105
self._assert_tzawareness_compat(other)
11061106
return _cmp_scalar(self.value, ots.value, op)
11071107

1108+
def __reduce_ex__(self, protocol):
1109+
# python 3.6 compat
1110+
# http://bugs.python.org/issue28730
1111+
# now __reduce_ex__ is defined and higher priority than __reduce__
1112+
return self.__reduce__()
1113+
11081114
def __repr__(self):
11091115
stamp = self._repr_base
11101116
zone = None

pandas/types/common.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,8 @@ def _is_unorderable_exception(e):
196196
These are different error message for PY>=3<=3.5 and PY>=3.6
197197
"""
198198
if PY36:
199-
return ("'>' not supported between instances "
200-
"of 'str' and 'int'" in str(e))
199+
return "'>' not supported between instances of" in str(e)
200+
201201
elif PY3:
202202
return 'unorderable' in str(e)
203203
return False

0 commit comments

Comments
 (0)