diff --git a/pandas/tseries/index.py b/pandas/tseries/index.py index 7aaec511b82bf..6aa926d2feae4 100644 --- a/pandas/tseries/index.py +++ b/pandas/tseries/index.py @@ -376,7 +376,7 @@ def _generate(cls, start, end, periods, name, offset, try: inferred_tz = tools._infer_tzinfo(start, end) - except: + except AssertionError: raise ValueError('Start and end cannot both be tz-aware with ' 'different timezones') @@ -390,7 +390,7 @@ def _generate(cls, start, end, periods, name, offset, tz = tz.localize(date.replace(tzinfo=None)).tzinfo if tz is not None and inferred_tz is not None: - if not inferred_tz == tz: + if not tslib.get_timezone(inferred_tz) == tslib.get_timezone(tz): raise AssertionError("Inferred time zone not equal to passed " "time zone")