summaryrefslogtreecommitdiff
path: root/py/builtin.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-01-21 21:54:15 +0000
committerDamien George <damien.p.george@gmail.com>2014-01-21 21:54:15 +0000
commit12eaccacda83a15500dae4616b3c37deecb57182 (patch)
tree5ec75424388c0be9e3591f981982d891c07669cc /py/builtin.c
parent55baff4c9bcbc001cbb8972c289ebfa356d4665b (diff)
parent7280f790881fa174e4d234266ff42f0fe3d847bc (diff)
Merge branch 'master' of github.com:micropython/micropython
Conflicts: py/objstr.c py/py.mk py/stream.c unix/main.c unix/socket.c
Diffstat (limited to 'py/builtin.c')
-rw-r--r--py/builtin.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/py/builtin.c b/py/builtin.c
index 8340ad304..9cbc03767 100644
--- a/py/builtin.c
+++ b/py/builtin.c
@@ -350,3 +350,15 @@ static mp_obj_t mp_builtin_str(mp_obj_t o_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_str_obj, mp_builtin_str);
+
+// TODO: This should be type, this is just quick CPython compat hack
+static mp_obj_t mp_builtin_bytes(uint n_args, const mp_obj_t *args) {
+ if (!MP_OBJ_IS_QSTR(args[0]) && !MP_OBJ_IS_TYPE(args[0], &str_type)) {
+ assert(0);
+ }
+ // Currently, MicroPython strings are mix between CPython byte and unicode
+ // strings. So, conversion is null so far.
+ return args[0];
+}
+
+MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_bytes_obj, 1, 3, mp_builtin_bytes);