[1.7.x] Fixed #22565 -- Prevented pgettext_lazy crash with bytestring input

Thanks ygbo for the report.
Backport of 142c27218 from master.