BUG: tz_localize(UTC) not making a copy by jbrockmendel · Pull Request #46460 · pandas-dev/pandas (original) (raw)
You may be aware, but looks like this PR didn't fully pass the CI checks
_______________________ test_tz_localize_to_utc_copies ________________________
[gw1] win32 -- Python 3.8.12 C:\Miniconda\envs\pandas-dev\python.exe
def test_tz_localize_to_utc_copies():
# GH#46460
arr = np.arange(5, dtype="i8")
result = tzconversion.tz_convert_from_utc(arr, tz=UTC)
tm.assert_numpy_array_equal(result, arr)
assert not np.shares_memory(arr, result)
> result = tzconversion.tz_convert_from_utc(arr, tz=None)
pandas\tests\tslibs\test_conversion.py:60:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pandas\_libs\tslibs\tzconversion.pyx:506: in pandas._libs.tslibs.tzconversion.tz_convert_from_utc
converted = _tz_convert_from_utc(vals, tz)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> local_val = utc_val + deltas[pos]
E UnboundLocalError: local variable 'deltas' referenced before assignment
pandas\_libs\tslibs\tzconversion.pyx:571: UnboundLocalError