Skip to content

Commit b013aea

Browse files
committed
py: Fix builtin hex to print prefix.
I was too hasty. Still a one-liner though.
1 parent 5805111 commit b013aea

3 files changed

Lines changed: 3 additions & 2 deletions

File tree

py/builtin.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ STATIC mp_obj_t mp_builtin_hash(mp_obj_t o_in) {
208208
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_hash_obj, mp_builtin_hash);
209209

210210
STATIC mp_obj_t mp_builtin_hex(mp_obj_t o_in) {
211-
return mp_binary_op(MP_BINARY_OP_MODULO, MP_OBJ_NEW_QSTR(MP_QSTR__percent_x), o_in);
211+
return mp_binary_op(MP_BINARY_OP_MODULO, MP_OBJ_NEW_QSTR(MP_QSTR__percent__hash_x), o_in);
212212
}
213213

214214
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_hex_obj, mp_builtin_hex);

py/makeqstrdata.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
codepoint2name[ord(':')] = 'colon'
1818
codepoint2name[ord('/')] = 'slash'
1919
codepoint2name[ord('%')] = 'percent'
20+
codepoint2name[ord('#')] = 'hash'
2021

2122
# this must match the equivalent function in qstr.c
2223
def compute_hash(qstr):

py/qstrdefs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Q(getattr)
107107
Q(globals)
108108
Q(hash)
109109
Q(hex)
110-
Q(%x)
110+
Q(%#x)
111111
Q(id)
112112
Q(io)
113113
Q(int)

0 commit comments

Comments
 (0)