CLN: remove have_pytz? · Issue #17251 · pandas-dev/pandas (original) (raw)

From tslib.pyx

try:
    import pytz
    UTC = pytz.utc
    have_pytz = True
except:
    have_pytz = False

[...]
def tz_convert_single(int64_t val, object tz1, object tz2):
    [...]
    if not have_pytz:
        import pytz

From much earlier in tslib.pyx

from pytz.tzinfo import BaseTzInfo as _pytz_BaseTzInfo

Is the try/except still necessary? If so, is import pytz the right thing to do in tz_convert_single?