diff -u b/Lib/test/test_format.py b/Lib/test/test_format.py --- b/Lib/test/test_format.py Mon Jan 20 15:50:44 2014 -0600 +++ b/Lib/test/test_format.py Mon Jan 20 15:39:21 2014 -0600 @@ -224,9 +224,9 @@ testboth("%o", -0o42, "-42") testboth("%o", float(0o42), "42") testformat("%r", "\u0378", "'\\u0378'") # non printable - testformat("%a", "\u0378", "'\\u0378'") # non printable + testboth("%a", "\u0378", "'\\u0378'") # non printable testformat("%r", "\u0374", "'\u0374'") # printable - testformat("%a", "\u0374", "'\\u0374'") # printable + testboth("%a", "\u0374", "'\\u0374'") # printable # alternate float formatting testboth('%g', 1.1, '1.1') diff -u b/Objects/bytesobject.c b/Objects/bytesobject.c --- b/Objects/bytesobject.c Mon Jan 20 15:50:44 2014 -0600 +++ b/Objects/bytesobject.c Mon Jan 20 15:39:21 2014 -0600 @@ -587,6 +587,7 @@ int isnumok; PyObject *v = NULL; PyObject *temp = NULL; + PyObject *temp2; Py_buffer buf; char *pbuf; int sign; @@ -746,6 +747,19 @@ pbuf = "%"; len = 1; break; + case 'a': + temp2 = PyObject_ASCII(v); + if (temp2 == NULL) + goto error; + temp = PyUnicode_AsLatin1String(temp2); + Py_DECREF(temp2); + if (temp == NULL) + goto error; + pbuf = PyBytes_AS_STRING(temp); + len = PyBytes_GET_SIZE(temp); + if (prec >= 0 && len > prec) + len = prec; + break; case 's': if (_getbuffer(v, &buf) < 0) { temp = format_obj(v);