diff Objects/bytesobject.c @ 72918:d76338eacf7c

Issue #13088: Add shared Py_hexdigits constant to format a number into base 16
author Victor Stinner <victor.stinner@haypocalc.com>
date Fri, 14 Oct 2011 02:13:11 +0200
parents e6a2b54c1d16
children c1effa2cdd20
line wrap: on
line diff
--- a/Objects/bytesobject.c	Fri Oct 14 00:08:29 2011 +0200
+++ b/Objects/bytesobject.c	Fri Oct 14 02:13:11 2011 +0200
@@ -564,7 +564,6 @@
 PyObject *
 PyBytes_Repr(PyObject *obj, int smartquotes)
 {
-    static const char *hexdigits = "0123456789abcdef";
     register PyBytesObject* op = (PyBytesObject*) obj;
     Py_ssize_t i, length = Py_SIZE(op);
     size_t newsize, squotes, dquotes;
@@ -620,8 +619,8 @@
         else if (c < ' ' || c >= 0x7f) {
             *p++ = '\\';
             *p++ = 'x';
-            *p++ = hexdigits[(c & 0xf0) >> 4];
-            *p++ = hexdigits[c & 0xf];
+            *p++ = Py_hexdigits[(c & 0xf0) >> 4];
+            *p++ = Py_hexdigits[c & 0xf];
         }
         else
             *p++ = c;