Skip to content

Commit a649d72

Browse files
committed
py/makeqstrdata: Add special case to handle \n qstr.
1 parent 2243d68 commit a649d72

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

py/makeqstrdata.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ def parse_input_headers(infiles):
9393

9494
# get the qstr value
9595
qstr = match.group(1)
96+
97+
# special case to specify control characters
98+
if qstr == '\\n':
99+
qstr = '\n'
100+
101+
# work out the corresponding qstr name
96102
ident = qstr_escape(qstr)
97103

98104
# don't add duplicates

py/objstr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ STATIC mp_obj_t str_splitlines(size_t n_args, const mp_obj_t *pos_args, mp_map_t
564564
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args,
565565
MP_ARRAY_SIZE(allowed_args), allowed_args, (mp_arg_val_t*)&args);
566566

567-
mp_obj_t new_args[2] = {pos_args[0], MP_OBJ_NEW_QSTR(MP_QSTR__backslash_n)};
567+
mp_obj_t new_args[2] = {pos_args[0], MP_OBJ_NEW_QSTR(MP_QSTR__0x0a_)};
568568
return str_split_internal(2, new_args, SPLITLINES | (args.keepends.u_bool ? KEEP : 0));
569569
}
570570
#endif

0 commit comments

Comments
 (0)