Mercurial > cpython-lru_cache-weakref
diff Modules/_codecsmodule.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 | 8beaa9a37387 |
| children | af0800b986b7 |
line wrap: on
line diff
--- a/Modules/_codecsmodule.c Fri Oct 14 00:08:29 2011 +0200 +++ b/Modules/_codecsmodule.c Fri Oct 14 02:13:11 2011 +0200 @@ -162,7 +162,6 @@ escape_encode(PyObject *self, PyObject *args) { - static const char *hexdigits = "0123456789abcdef"; PyObject *str; Py_ssize_t size; Py_ssize_t newsize; @@ -205,8 +204,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;
