Code Sample, a copy-pastable example if possible

import win32timezone
import pywintypes
import pandas

d = pywintypes.TimeType(2001, 1, 1, tzinfo=win32timezone.TimeZoneInfo('Eastern Standard Time'))

ix = pandas.Index([d])  ## crash occurs here

Problem description

In the example above, tzinfo.utcoffset(None) returns None. In tslib.pyx _get_dst_info calls int(total_seconds(_get_utcoffset(tz, None))), and _get_utcoffset(tz, None) returns None. This causes a hard crash because total_seconds from datetime_helper.h expects a timedelta object, and crashes if the attributes "microseconds", "seconds" or "days" don't exist.

// from datetime_helper.h
npy_int64 get_long_attr(PyObject *o, const char *attr) {
  npy_int64 long_val;
  PyObject *value = PyObject_GetAttrString(o, attr);  <-- This returns NULL

When using a timezone from pytz the _utcoffset attribute is set, which is used by _get_utcoffset, and so this crash doesn't happen with that library.

Expected Output

It shouldn't crash. Ideally it would handle these timezone types, but at least it should raise an Exception if the timezone type isn't currently supported.

Output of pd.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 3.5.2.final.0 python-bits: 64 OS: Windows OS-release: 10 machine: AMD64 processor: Intel64 Family 6 Model 78 Stepping 3, GenuineIntel byteorder: little LC_ALL: None LANG: None LOCALE: None.None pandas: 0.20.0rc1+6.g844013b20.dirty pytest: 3.0.5 pip: 9.0.1 setuptools: 34.3.3 Cython: 0.25.2 numpy: 1.11.2 scipy: None xarray: None IPython: 5.3.0 sphinx: 1.5.3 patsy: None dateutil: 2.6.0 pytz: 2016.10 blosc: None bottleneck: None tables: None numexpr: None feather: None matplotlib: None openpyxl: 2.4.1 xlrd: None xlwt: None xlsxwriter: 0.9.3 lxml: None bs4: None html5lib: None sqlalchemy: 1.1.4 pymysql: None psycopg2: 2.7.1 (dt dec pq3 ext lo64) jinja2: 2.9.5 s3fs: None pandas_gbq: None pandas_datareader: None

Comment From: jreback

duplicate of #10459

if you want to submit a PR to make this raise NotImplementedError as suggested in that issue great. These are not accepted by pandas, nor do these timezone objects follow the specifications.