Issue #6415: Fixed warnings.warn sagfault on bad formatted string.
diff --git a/Python/_warnings.c b/Python/_warnings.c
index 219cfc6..18fcdac 100644
--- a/Python/_warnings.c
+++ b/Python/_warnings.c
@@ -317,6 +317,8 @@
     }
     if (rc == 1) {
         text = PyObject_Str(message);
+        if (text == NULL)
+            goto cleanup;
         category = (PyObject*)message->ob_type;
     }
     else {