From a649d726063d548bbf5f05aef8c4420ddf0cfe6e Mon Sep 17 00:00:00 2001
From: Damien George <damien.p.george@gmail.com>
Date: Thu, 14 Apr 2016 15:22:36 +0100
Subject: [PATCH] py/makeqstrdata: Add special case to handle \n qstr.

---
 py/makeqstrdata.py | 6 ++++++
 py/objstr.c        | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/py/makeqstrdata.py b/py/makeqstrdata.py
index 325207c05..c00ec1eb2 100644
--- a/py/makeqstrdata.py
+++ b/py/makeqstrdata.py
@@ -93,6 +93,12 @@ def parse_input_headers(infiles):
 
                 # get the qstr value
                 qstr = match.group(1)
+
+                # special case to specify control characters
+                if qstr == '\\n':
+                    qstr = '\n'
+
+                # work out the corresponding qstr name
                 ident = qstr_escape(qstr)
 
                 # don't add duplicates
diff --git a/py/objstr.c b/py/objstr.c
index 0c2d90403..d0d090b99 100644
--- a/py/objstr.c
+++ b/py/objstr.c
@@ -564,7 +564,7 @@ STATIC mp_obj_t str_splitlines(size_t n_args, const mp_obj_t *pos_args, mp_map_t
     mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args,
         MP_ARRAY_SIZE(allowed_args), allowed_args, (mp_arg_val_t*)&args);
 
-    mp_obj_t new_args[2] = {pos_args[0], MP_OBJ_NEW_QSTR(MP_QSTR__backslash_n)};
+    mp_obj_t new_args[2] = {pos_args[0], MP_OBJ_NEW_QSTR(MP_QSTR__0x0a_)};
     return str_split_internal(2, new_args, SPLITLINES | (args.keepends.u_bool ? KEEP : 0));
 }
 #endif
-- 
GitLab