diff options
author | Damien George <damien.p.george@gmail.com> | 2014-01-24 15:15:47 -0800 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-01-24 15:15:47 -0800 |
commit | fcd4ae827171717ea501bf833a6b6abd70edc5a3 (patch) | |
tree | 87dab361b687f70f2c47139c53ddf820c471cbb8 /py/runtime.c | |
parent | 58b8a6202ac5f5c66bc136e7cfc553db4bf88845 (diff) | |
parent | 91fb1c9b13021e90fa2f8c2105c135fc14ac71db (diff) | |
download | micropython-fcd4ae827171717ea501bf833a6b6abd70edc5a3.tar.gz micropython-fcd4ae827171717ea501bf833a6b6abd70edc5a3.zip |
Merge pull request #221 from pfalcon/basic-bytes
Add basic implementation of bytes type, piggybacking on str.
Diffstat (limited to 'py/runtime.c')
-rw-r--r-- | py/runtime.c | 7 |
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)); |