Use force_text instead of testing inline for py3 in fix for #20386 as Aymeric suggested