BUG: Fixed regression in PeriodIndex loc
Closes https://github.com/pandas-dev/pandas/issues/33964.

This is the smallest change I could get. I'm not sure what a more comprehensive fix would look like.

Regression only on master, so no need for a whatsnew.