bpo-32591: Fix PyExc_WarnFormat call (follow-up commit) (#5263)

The previous version was correct in terms of behaviour, but
checking the return value of PyErr_WarnFormat allows to
avoid calling PyErr_Occurred and silences the coverity alarm.
1 file changed