From b013aea80927ae85461f382c601f8ac40c06497a Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 15 Apr 2014 12:50:21 +0100 Subject: [PATCH] py: Fix builtin hex to print prefix. I was too hasty. Still a one-liner though. --- py/builtin.c | 2 +- py/makeqstrdata.py | 1 + py/qstrdefs.h | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/py/builtin.c b/py/builtin.c index b02608b407..5911fa6342 100644 --- a/py/builtin.c +++ b/py/builtin.c @@ -208,7 +208,7 @@ STATIC mp_obj_t mp_builtin_hash(mp_obj_t o_in) { MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_hash_obj, mp_builtin_hash); STATIC mp_obj_t mp_builtin_hex(mp_obj_t o_in) { - return mp_binary_op(MP_BINARY_OP_MODULO, MP_OBJ_NEW_QSTR(MP_QSTR__percent_x), o_in); + return mp_binary_op(MP_BINARY_OP_MODULO, MP_OBJ_NEW_QSTR(MP_QSTR__percent__hash_x), o_in); } MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_hex_obj, mp_builtin_hex); diff --git a/py/makeqstrdata.py b/py/makeqstrdata.py index f8605ae093..8620af5673 100644 --- a/py/makeqstrdata.py +++ b/py/makeqstrdata.py @@ -17,6 +17,7 @@ codepoint2name[ord('.')] = 'dot' codepoint2name[ord(':')] = 'colon' codepoint2name[ord('/')] = 'slash' codepoint2name[ord('%')] = 'percent' +codepoint2name[ord('#')] = 'hash' # this must match the equivalent function in qstr.c def compute_hash(qstr): diff --git a/py/qstrdefs.h b/py/qstrdefs.h index e9f2d8d9a4..d18882f69e 100644 --- a/py/qstrdefs.h +++ b/py/qstrdefs.h @@ -107,7 +107,7 @@ Q(getattr) Q(globals) Q(hash) Q(hex) -Q(%x) +Q(%#x) Q(id) Q(io) Q(int)