#19449: Handle non-string keys when generating 'fieldnames' error.

Backport from 3.3 6e5afeada7ca.