Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
PY36 compat for fold
  • Loading branch information
Matt Roeschke committed Jan 30, 2019
commit 6a57b5a9eb191bfd788fe1e5a1be82c1699ec20a
12 changes: 8 additions & 4 deletions pandas/_libs/tslibs/timestamps.pyx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
import sys
import warnings

from cpython cimport (PyObject_RichCompareBool, PyObject_RichCompare,
Expand Down Expand Up @@ -43,7 +44,7 @@ from pandas._libs.tslibs.timezones import UTC
# Constants
_zero_time = datetime_time(0, 0)
_no_input = object()

PY36 = sys.version_info >= (3, 6)

# ----------------------------------------------------------------------

Expand Down Expand Up @@ -1255,9 +1256,12 @@ class Timestamp(_Timestamp):
is_dst=not bool(fold))
_tzinfo = ts_input.tzinfo
else:
ts_input = datetime(dts.year, dts.month, dts.day,
dts.hour, dts.min, dts.sec, dts.us,
tzinfo=_tzinfo, fold=fold)
kwargs = {'year': dts.year, 'month': dts.month, 'day': dts.day,
'hour': dts.hour, 'minute': dts.min, 'second': dts.sec,
'microsecond': dts.us, 'tzinfo': _tzinfo}
if PY36:
kwargs['fold'] = fold
ts_input = datetime(**kwargs)

ts = convert_datetime_to_tsobject(ts_input, _tzinfo)
value = ts.value + (dts.ps // 1000)
Expand Down