repr(b"\0") should return b"\x00", not the (unusual) b"\0".
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index cb830e3..3a707ac 100644
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -849,7 +849,7 @@
             else if (c == '\r')
                 *p++ = '\\', *p++ = 'r';
             else if (c == 0)
-                *p++ = '\\', *p++ = '0';
+                *p++ = '\\', *p++ = 'x', *p++ = '0', *p++ = '0';
             else if (c < ' ' || c >= 0x7f) {
                 /* For performance, we don't want to call
                    PyOS_snprintf here (extra layers of