py: Add support for __debug__ constant.

__debug__ now resolves to True or False.  Its value needs to be set by
mp_set_debug().

TODO: call mp_set_debug in unix/ port.

TODO: optimise away "if False:" statements in compiler.
This commit is contained in:
Damien George
2014-05-12 23:07:34 +01:00
parent 96f137b24a
commit 97f9a2813e
3 changed files with 25 additions and 4 deletions

View File

@@ -69,11 +69,14 @@ const mp_obj_module_t mp_module___main__ = {
};
void mp_init(void) {
// call port specific initialization if any
// call port specific initialization if any
#ifdef MICROPY_PORT_INIT_FUNC
MICROPY_PORT_INIT_FUNC;
#endif
// __debug__ enabled by default
mp_set_debug(true);
mp_emit_glue_init();
// init global module stuff