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/Modules/_json.c b/Modules/_json.c
index 95c658c..40c2ced 100644
--- a/Modules/_json.c
+++ b/Modules/_json.c
@@ -246,6 +246,7 @@
         }
     }
     output[chars++] = '"';
+    assert(_PyUnicode_CheckConsistency(rval, 1));
     return rval;
 }