repr(b"\0") should return b"\x00", not the (unusual) b"\0".

This commit is contained in:
Guido van Rossum 2007-05-08 19:09:34 +00:00
parent e5e80b8c56
commit 57b93ad56d
2 changed files with 4 additions and 3 deletions

View file

@ -849,7 +849,7 @@ bytes_repr(PyBytesObject *self)
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