diff options
author | Damien George <damien.p.george@gmail.com> | 2014-06-07 22:02:35 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-06-07 22:02:35 +0100 |
commit | d31a093f9c2bdc3c94917c928fb2cc8c26b39959 (patch) | |
tree | 8d45798562c303ebfdf889e3babdfbb0b2abc210 /py | |
parent | f0778a7ccbbdd1d7bf116a6939c7eb05173e1987 (diff) | |
parent | 5473f743f37e12921f4acb11fa84fe0d2b9d0650 (diff) | |
download | micropython-d31a093f9c2bdc3c94917c928fb2cc8c26b39959.tar.gz micropython-d31a093f9c2bdc3c94917c928fb2cc8c26b39959.zip |
Merge branch 'master' of github.com:micropython/micropython
Conflicts:
py/emitglue.c
Diffstat (limited to 'py')
-rw-r--r-- | py/modsys.c | 6 | ||||
-rw-r--r-- | py/objtype.c | 6 | ||||
-rw-r--r-- | py/qstrdefs.h | 4 | ||||
-rw-r--r-- | py/runtime.c | 4 | ||||
-rw-r--r-- | py/runtime.h | 3 |
5 files changed, 20 insertions, 3 deletions
diff --git a/py/modsys.c b/py/modsys.c index 738758bdf4..a99db1b7f8 100644 --- a/py/modsys.c +++ b/py/modsys.c @@ -51,6 +51,9 @@ mp_obj_list_t mp_sys_argv_obj; STATIC const mp_obj_tuple_t mp_sys_version_info_obj = {{&mp_type_tuple}, 3, {I(3), I(4), I(0)}}; #undef I STATIC const MP_DEFINE_STR_OBJ(version_obj, "3.4.0"); +#ifdef MICROPY_PY_SYS_PLATFORM +STATIC const MP_DEFINE_STR_OBJ(platform_obj, MICROPY_PY_SYS_PLATFORM); +#endif STATIC const mp_map_elem_t mp_module_sys_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_sys) }, @@ -59,6 +62,9 @@ STATIC const mp_map_elem_t mp_module_sys_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_argv), (mp_obj_t)&mp_sys_argv_obj }, { MP_OBJ_NEW_QSTR(MP_QSTR_version), (mp_obj_t)&version_obj }, { MP_OBJ_NEW_QSTR(MP_QSTR_version_info), (mp_obj_t)&mp_sys_version_info_obj }, +#ifdef MICROPY_PY_SYS_PLATFORM + { MP_OBJ_NEW_QSTR(MP_QSTR_platform), (mp_obj_t)&platform_obj }, +#endif #if MP_ENDIANNESS_LITTLE { MP_OBJ_NEW_QSTR(MP_QSTR_byteorder), MP_OBJ_NEW_QSTR(MP_QSTR_little) }, #else diff --git a/py/objtype.c b/py/objtype.c index dfe5eaa8f0..0d6674c33d 100644 --- a/py/objtype.c +++ b/py/objtype.c @@ -336,9 +336,9 @@ STATIC const qstr binary_op_method_name[] = { MP_BINARY_OP_INPLACE_FLOOR_DIVIDE, MP_BINARY_OP_INPLACE_TRUE_DIVIDE, MP_BINARY_OP_INPLACE_MODULO, - MP_BINARY_OP_INPLACE_POWER, - MP_BINARY_OP_LESS, - MP_BINARY_OP_MORE, + MP_BINARY_OP_INPLACE_POWER,*/ + [MP_BINARY_OP_LESS] = MP_QSTR___lt__, + /*MP_BINARY_OP_MORE, MP_BINARY_OP_EQUAL, MP_BINARY_OP_LESS_EQUAL, MP_BINARY_OP_MORE_EQUAL, diff --git a/py/qstrdefs.h b/py/qstrdefs.h index 69182f2809..521d4399a5 100644 --- a/py/qstrdefs.h +++ b/py/qstrdefs.h @@ -60,6 +60,7 @@ Q(__str__) Q(__getattr__) Q(__del__) Q(__call__) +Q(__lt__) Q(micropython) Q(bytecode) @@ -343,6 +344,9 @@ Q(byteorder) Q(big) Q(exit) Q(little) +#ifdef MICROPY_PY_SYS_PLATFORM +Q(platform) +#endif Q(stdin) Q(stdout) Q(stderr) diff --git a/py/runtime.c b/py/runtime.c index cdbf99d4a5..179b48d327 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -1150,6 +1150,10 @@ void *m_malloc_fail(int num_bytes) { nlr_raise((mp_obj_t)&mp_const_MemoryError_obj); } +NORETURN void mp_not_implemented(const char *msg) { + nlr_raise(mp_obj_new_exception_msg(&mp_type_NotImplementedError, msg)); +} + // these must correspond to the respective enum void *const mp_fun_table[MP_F_NUMBER_OF] = { mp_load_const_int, diff --git a/py/runtime.h b/py/runtime.h index dbd413180b..fb61c01dd1 100644 --- a/py/runtime.h +++ b/py/runtime.h @@ -112,6 +112,9 @@ mp_obj_t mp_import_name(qstr name, mp_obj_t fromlist, mp_obj_t level); mp_obj_t mp_import_from(mp_obj_t module, qstr name); void mp_import_all(mp_obj_t module); +// Raise NotImplementedError with given message +NORETURN void mp_not_implemented(const char *msg); + extern struct _mp_obj_list_t mp_sys_path_obj; extern struct _mp_obj_list_t mp_sys_argv_obj; #define mp_sys_path ((mp_obj_t)&mp_sys_path_obj) |