Check newly created consistency using _PyUnicode_CheckConsistency(str, 1)

 * In debug mode, fill the string data with invalid characters
 * Simplify also reference counting in PyCodec_BackslashReplaceErrors()
   and PyCodec_XMLCharRefReplaceError()
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index 2e6be43..b07be26 100644
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -626,6 +626,7 @@
             *p++ = c;
     }
     *p++ = quote;
+    assert(_PyUnicode_CheckConsistency(v, 1));
     return v;
 }