py: Fix builtin hex to print prefix.

I was too hasty.  Still a one-liner though.
This commit is contained in:
Damien George 2014-04-15 12:50:21 +01:00
parent 5805111732
commit b013aea809
3 changed files with 3 additions and 2 deletions

View File

@ -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);

View File

@ -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):

View File

@ -107,7 +107,7 @@ Q(getattr)
Q(globals)
Q(hash)
Q(hex)
Q(%x)
Q(%#x)
Q(id)
Q(io)
Q(int)