summaryrefslogtreecommitdiffstatshomepage
path: root/py/runtime.c
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-01-24 22:50:40 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-01-24 22:56:26 +0200
commit91fb1c9b13021e90fa2f8c2105c135fc14ac71db (patch)
tree9edfc5ee0ddbfd03d14934321c7c963a5c6c7921 /py/runtime.c
parent2b2cb7b7f4f467b67082f79053118df78f48e66e (diff)
downloadmicropython-91fb1c9b13021e90fa2f8c2105c135fc14ac71db.tar.gz
micropython-91fb1c9b13021e90fa2f8c2105c135fc14ac71db.zip
Add basic implementation of bytes type, piggybacking on str.
This reuses as much str implementation as possible, from this we can make them more separate as needed.
Diffstat (limited to 'py/runtime.c')
-rw-r--r--py/runtime.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/py/runtime.c b/py/runtime.c
index 0d9906ea60..3d56cc87ba 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -408,6 +408,13 @@ mp_obj_t rt_load_const_str(qstr qstr) {
return MP_OBJ_NEW_QSTR(qstr);
}
+mp_obj_t rt_load_const_bytes(qstr qstr) {
+ DEBUG_OP_printf("load b'%s'\n", qstr_str(qstr));
+ uint len;
+ const byte *data = qstr_data(qstr, &len);
+ return mp_obj_new_bytes(data, len);
+}
+
mp_obj_t rt_load_name(qstr qstr) {
// logic: search locals, globals, builtins
DEBUG_OP_printf("load name %s\n", qstr_str(qstr));