Issue #20434 Correct error handlin of _PyString_Resize and _PyBytes_Resize
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index 83dab08..0b6d36c 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -748,8 +748,8 @@
                              UTF-8 bytes may follow. */
         }
     }
-    if (p-buf < newlen && _PyString_Resize(&v, p - buf))
-        goto failed;
+    if (p-buf < newlen)
+        _PyString_Resize(&v, p - buf); /* v is cleared on error */
     return v;
   failed:
     Py_DECREF(v);