blob: fa1a8397e151e5114625372515f5ed85431da6d6 [file] [log] [blame]
Damien George04b91472014-05-03 23:27:38 +01001/*
2 * This file is part of the Micro Python project, http://micropython.org/
3 *
4 * The MIT License (MIT)
5 *
6 * Copyright (c) 2013, 2014 Damien P. George
Paul Sokolovskyda9f0922014-05-13 08:44:45 +03007 * Copyright (c) 2014 Paul Sokolovsky
Damien George04b91472014-05-03 23:27:38 +01008 *
9 * Permission is hereby granted, free of charge, to any person obtaining a copy
10 * of this software and associated documentation files (the "Software"), to deal
11 * in the Software without restriction, including without limitation the rights
12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 * copies of the Software, and to permit persons to whom the Software is
14 * furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 * THE SOFTWARE.
26 */
27
Damien George66028ab2014-01-03 14:03:48 +000028#include <stdint.h>
Damien George66028ab2014-01-03 14:03:48 +000029#include <stdio.h>
Damien George66028ab2014-01-03 14:03:48 +000030#include <string.h>
31#include <assert.h>
stijn98e2ee02014-05-03 10:14:16 +020032#include <alloca.h>
Damien George66028ab2014-01-03 14:03:48 +000033
Paul Sokolovskyf54bcbf2014-05-02 17:47:01 +030034#include "mpconfig.h"
Damien George66028ab2014-01-03 14:03:48 +000035#include "nlr.h"
36#include "misc.h"
Damien George55baff42014-01-21 21:40:13 +000037#include "qstr.h"
Damien George66028ab2014-01-03 14:03:48 +000038#include "lexer.h"
39#include "lexerunix.h"
40#include "parse.h"
Damien George66028ab2014-01-03 14:03:48 +000041#include "obj.h"
Damien Georgecaac5422014-03-25 14:18:18 +000042#include "objmodule.h"
Damien Georgec5966122014-02-15 16:10:44 +000043#include "parsehelper.h"
Damien George1fb03172014-01-03 14:22:03 +000044#include "compile.h"
Damien George66028ab2014-01-03 14:03:48 +000045#include "runtime0.h"
46#include "runtime.h"
Damien George66028ab2014-01-03 14:03:48 +000047#include "builtin.h"
48
Paul Sokolovskye0813292014-04-11 23:08:29 +030049#if 0 // print debugging info
50#define DEBUG_PRINT (1)
51#define DEBUG_printf DEBUG_printf
52#else // don't print debugging info
53#define DEBUG_printf(...) (void)0
54#endif
55
Damien Georgee09ffa12014-02-05 23:57:48 +000056#define PATH_SEP_CHAR '/'
57
Damien Georgee09ffa12014-02-05 23:57:48 +000058mp_import_stat_t stat_dir_or_file(vstr_t *path) {
59 //printf("stat %s\n", vstr_str(path));
60 mp_import_stat_t stat = mp_import_stat(vstr_str(path));
61 if (stat == MP_IMPORT_STAT_DIR) {
62 return stat;
Damien George66028ab2014-01-03 14:03:48 +000063 }
Damien Georgee09ffa12014-02-05 23:57:48 +000064 vstr_add_str(path, ".py");
65 stat = mp_import_stat(vstr_str(path));
66 if (stat == MP_IMPORT_STAT_FILE) {
67 return stat;
Paul Sokolovskyd720ab52014-01-20 00:03:34 +020068 }
Damien Georgee09ffa12014-02-05 23:57:48 +000069 return MP_IMPORT_STAT_NO_EXIST;
70}
Paul Sokolovskyd720ab52014-01-20 00:03:34 +020071
Damien Georgee09ffa12014-02-05 23:57:48 +000072mp_import_stat_t find_file(const char *file_str, uint file_len, vstr_t *dest) {
73 // extract the list of paths
Paul Sokolovskye11b17c2014-02-05 00:47:06 +020074 uint path_num = 0;
75 mp_obj_t *path_items;
Damien Georgeee3fd462014-05-24 23:03:12 +010076#if MICROPY_PY_SYS
Paul Sokolovsky5500cde2014-04-13 06:43:18 +030077 mp_obj_list_get(mp_sys_path, &path_num, &path_items);
Damien George49f20b82014-04-13 13:05:16 +010078#endif
Paul Sokolovskye11b17c2014-02-05 00:47:06 +020079
80 if (path_num == 0) {
Damien Georged17926d2014-03-30 13:35:08 +010081 // mp_sys_path is empty, so just use the given file name
Damien Georgee09ffa12014-02-05 23:57:48 +000082 vstr_add_strn(dest, file_str, file_len);
83 return stat_dir_or_file(dest);
Paul Sokolovskye11b17c2014-02-05 00:47:06 +020084 } else {
Damien Georgee09ffa12014-02-05 23:57:48 +000085 // go through each path looking for a directory or file
Paul Sokolovskye11b17c2014-02-05 00:47:06 +020086 for (int i = 0; i < path_num; i++) {
Damien Georgee09ffa12014-02-05 23:57:48 +000087 vstr_reset(dest);
Paul Sokolovskye11b17c2014-02-05 00:47:06 +020088 uint p_len;
Damien George698ec212014-02-08 18:17:23 +000089 const char *p = mp_obj_str_get_data(path_items[i], &p_len);
Paul Sokolovskye11b17c2014-02-05 00:47:06 +020090 if (p_len > 0) {
Damien George698ec212014-02-08 18:17:23 +000091 vstr_add_strn(dest, p, p_len);
Damien Georgee09ffa12014-02-05 23:57:48 +000092 vstr_add_char(dest, PATH_SEP_CHAR);
Paul Sokolovskye11b17c2014-02-05 00:47:06 +020093 }
Damien Georgee09ffa12014-02-05 23:57:48 +000094 vstr_add_strn(dest, file_str, file_len);
95 mp_import_stat_t stat = stat_dir_or_file(dest);
96 if (stat != MP_IMPORT_STAT_NO_EXIST) {
97 return stat;
Paul Sokolovskye11b17c2014-02-05 00:47:06 +020098 }
99 }
Damien Georgee09ffa12014-02-05 23:57:48 +0000100
101 // could not find a directory or file
102 return MP_IMPORT_STAT_NO_EXIST;
Paul Sokolovskye11b17c2014-02-05 00:47:06 +0200103 }
Damien Georgee09ffa12014-02-05 23:57:48 +0000104}
105
106void do_load(mp_obj_t module_obj, vstr_t *file) {
107 // create the lexer
108 mp_lexer_t *lex = mp_lexer_new_from_file(vstr_str(file));
Paul Sokolovskye11b17c2014-02-05 00:47:06 +0200109
Damien George66028ab2014-01-03 14:03:48 +0000110 if (lex == NULL) {
Damien Georgee09ffa12014-02-05 23:57:48 +0000111 // we verified the file exists using stat, but lexer could still fail
Andrew Schellerf78cfaf2014-04-09 19:56:38 +0100112 nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ImportError, "No module named '%s'", vstr_str(file)));
Damien George66028ab2014-01-03 14:03:48 +0000113 }
114
Damien Georgee09ffa12014-02-05 23:57:48 +0000115 qstr source_name = mp_lexer_source_name(lex);
Damien George66028ab2014-01-03 14:03:48 +0000116
117 // save the old context
Damien George7efc5b32014-04-05 22:36:42 +0100118 mp_obj_dict_t *old_locals = mp_locals_get();
119 mp_obj_dict_t *old_globals = mp_globals_get();
Damien George66028ab2014-01-03 14:03:48 +0000120
121 // set the new context
Damien George7efc5b32014-04-05 22:36:42 +0100122 mp_locals_set(mp_obj_module_get_globals(module_obj));
123 mp_globals_set(mp_obj_module_get_globals(module_obj));
Damien George66028ab2014-01-03 14:03:48 +0000124
125 // parse the imported script
Damien Georgec5966122014-02-15 16:10:44 +0000126 mp_parse_error_kind_t parse_error_kind;
127 mp_parse_node_t pn = mp_parse(lex, MP_PARSE_FILE_INPUT, &parse_error_kind);
Damien George66028ab2014-01-03 14:03:48 +0000128
129 if (pn == MP_PARSE_NODE_NULL) {
Damien George9528cd62014-01-15 21:23:31 +0000130 // parse error; clean up and raise exception
Damien George4b01de42014-04-13 11:56:02 +0100131 mp_obj_t exc = mp_parse_make_exception(lex, parse_error_kind);
132 mp_lexer_free(lex);
Damien Georged17926d2014-03-30 13:35:08 +0100133 mp_locals_set(old_locals);
134 mp_globals_set(old_globals);
Damien George4b01de42014-04-13 11:56:02 +0100135 nlr_raise(exc);
Damien George66028ab2014-01-03 14:03:48 +0000136 }
137
Damien George4b01de42014-04-13 11:56:02 +0100138 mp_lexer_free(lex);
139
Damien George9528cd62014-01-15 21:23:31 +0000140 // compile the imported script
Damien George65cad122014-04-06 11:48:15 +0100141 mp_obj_t module_fun = mp_compile(pn, source_name, MP_EMIT_OPT_NONE, false);
Damien Georgeb829b5c2014-01-25 13:51:19 +0000142 mp_parse_node_free(pn);
Damien Georgeeb7bfcb2014-01-04 15:57:35 +0000143
144 if (module_fun == mp_const_none) {
Damien George66028ab2014-01-03 14:03:48 +0000145 // TODO handle compile error correctly
Damien Georged17926d2014-03-30 13:35:08 +0100146 mp_locals_set(old_locals);
147 mp_globals_set(old_globals);
Paul Sokolovsky20e9ed32014-04-22 02:53:20 +0300148 nlr_raise(mp_obj_new_exception_msg(&mp_type_SyntaxError, "Syntax error in imported module"));
Damien George66028ab2014-01-03 14:03:48 +0000149 }
150
151 // complied successfully, execute it
Damien George66028ab2014-01-03 14:03:48 +0000152 nlr_buf_t nlr;
153 if (nlr_push(&nlr) == 0) {
Damien Georged17926d2014-03-30 13:35:08 +0100154 mp_call_function_0(module_fun);
Damien George66028ab2014-01-03 14:03:48 +0000155 nlr_pop();
156 } else {
157 // exception; restore context and re-raise same exception
Damien Georged17926d2014-03-30 13:35:08 +0100158 mp_locals_set(old_locals);
159 mp_globals_set(old_globals);
Damien Georgeea13f402014-04-05 18:32:08 +0100160 nlr_raise(nlr.ret_val);
Damien George66028ab2014-01-03 14:03:48 +0000161 }
Damien Georged17926d2014-03-30 13:35:08 +0100162 mp_locals_set(old_locals);
163 mp_globals_set(old_globals);
Damien Georgee09ffa12014-02-05 23:57:48 +0000164}
165
Paul Sokolovskya5afc902014-04-12 17:46:54 +0300166// TODO: Move to objdict?
167STATIC inline mp_obj_t mp_obj_dict_get(mp_obj_t dict_in, mp_obj_t key) {
168 mp_obj_dict_t *dict = dict_in;
169 mp_map_elem_t *elem = mp_map_lookup(&dict->map, key, MP_MAP_LOOKUP);
170 if (elem == NULL) {
171 return elem;
172 }
173 return elem->value;
174}
175
Damien George24ff0632014-03-24 10:47:13 +0000176mp_obj_t mp_builtin___import__(uint n_args, mp_obj_t *args) {
Paul Sokolovskye0813292014-04-11 23:08:29 +0300177#if DEBUG_PRINT
178 printf("__import__:\n");
Paul Sokolovskyfb7f9432014-02-20 00:29:54 +0200179 for (int i = 0; i < n_args; i++) {
Damien Georgee09ffa12014-02-05 23:57:48 +0000180 printf(" ");
Paul Sokolovskyfb7f9432014-02-20 00:29:54 +0200181 mp_obj_print(args[i], PRINT_REPR);
Damien Georgee09ffa12014-02-05 23:57:48 +0000182 printf("\n");
183 }
Paul Sokolovskye0813292014-04-11 23:08:29 +0300184#endif
Damien Georgee09ffa12014-02-05 23:57:48 +0000185
Paul Sokolovskya5afc902014-04-12 17:46:54 +0300186 mp_obj_t module_name = args[0];
Paul Sokolovskyfb7f9432014-02-20 00:29:54 +0200187 mp_obj_t fromtuple = mp_const_none;
Paul Sokolovskyfeacaa12014-02-21 01:15:20 +0200188 int level = 0;
Paul Sokolovskyfb7f9432014-02-20 00:29:54 +0200189 if (n_args >= 4) {
190 fromtuple = args[3];
Paul Sokolovskyfeacaa12014-02-21 01:15:20 +0200191 if (n_args >= 5) {
192 level = MP_OBJ_SMALL_INT_VALUE(args[4]);
193 }
194 }
195
Paul Sokolovskya5afc902014-04-12 17:46:54 +0300196 uint mod_len;
197 const char *mod_str = (const char*)mp_obj_str_get_data(module_name, &mod_len);
198
Paul Sokolovskyfeacaa12014-02-21 01:15:20 +0200199 if (level != 0) {
Paul Sokolovskya5afc902014-04-12 17:46:54 +0300200 // What we want to do here is to take name of current module,
201 // chop <level> trailing components, and concatenate with passed-in
202 // module name, thus resolving relative import name into absolue.
203 // This even appears to be correct per
204 // http://legacy.python.org/dev/peps/pep-0328/#relative-imports-and-name
205 // "Relative imports use a module's __name__ attribute to determine that
206 // module's position in the package hierarchy."
207 mp_obj_t this_name_q = mp_obj_dict_get(mp_globals_get(), MP_OBJ_NEW_QSTR(MP_QSTR___name__));
208 assert(this_name_q != MP_OBJ_NULL);
209#if DEBUG_PRINT
210 printf("Current module: ");
211 mp_obj_print(this_name_q, PRINT_REPR);
212 printf("\n");
213#endif
214
215 uint this_name_l;
216 const char *this_name = (const char*)mp_obj_str_get_data(this_name_q, &this_name_l);
217
218 uint dots_seen = 0;
219 const char *p = this_name + this_name_l - 1;
220 while (p > this_name) {
221 if (*p == '.') {
222 dots_seen++;
223 if (--level == 0) {
224 break;
225 }
226 }
227 p--;
228 }
229
230 if (dots_seen == 0 && level == 1) {
231 // http://legacy.python.org/dev/peps/pep-0328/#relative-imports-and-name
232 // "If the module's name does not contain any package information
233 // (e.g. it is set to '__main__') then relative imports are
234 // resolved as if the module were a top level module, regardless
235 // of where the module is actually located on the file system."
236 // Supposedly this if catches this condition and resolve it properly
237 // TODO: But nobody knows for sure. This condition happens when
238 // package's __init__.py does something like "import .submod". So,
239 // maybe we should check for package here? But quote above doesn't
240 // talk about packages, it talks about dot-less module names.
241 p = this_name + this_name_l;
242 } else if (level != 0) {
243 nlr_raise(mp_obj_new_exception_msg(&mp_type_ImportError, "Invalid relative import"));
244 }
245
246 uint new_mod_l = (mod_len == 0 ? p - this_name : p - this_name + 1 + mod_len);
247 char *new_mod = alloca(new_mod_l);
248 memcpy(new_mod, this_name, p - this_name);
249 if (mod_len != 0) {
250 new_mod[p - this_name] = '.';
251 memcpy(new_mod + (p - this_name) + 1, mod_str, mod_len);
252 }
253
254 qstr new_mod_q = qstr_from_strn(new_mod, new_mod_l);
255 DEBUG_printf("Resolved relative name: %s\n", qstr_str(new_mod_q));
256 module_name = MP_OBJ_NEW_QSTR(new_mod_q);
257 mod_str = new_mod;
258 mod_len = new_mod_l;
Paul Sokolovskyfb7f9432014-02-20 00:29:54 +0200259 }
260
Damien Georgee09ffa12014-02-05 23:57:48 +0000261 // check if module already exists
Paul Sokolovskya5afc902014-04-12 17:46:54 +0300262 mp_obj_t module_obj = mp_module_get(mp_obj_str_get_qstr(module_name));
Damien Georgee09ffa12014-02-05 23:57:48 +0000263 if (module_obj != MP_OBJ_NULL) {
Paul Sokolovskye0813292014-04-11 23:08:29 +0300264 DEBUG_printf("Module already loaded\n");
Paul Sokolovsky91ba7a52014-02-16 02:53:44 +0200265 // If it's not a package, return module right away
266 char *p = strchr(mod_str, '.');
267 if (p == NULL) {
268 return module_obj;
269 }
Paul Sokolovskyfb7f9432014-02-20 00:29:54 +0200270 // If fromlist is not empty, return leaf module
271 if (fromtuple != mp_const_none) {
272 return module_obj;
273 }
Paul Sokolovsky91ba7a52014-02-16 02:53:44 +0200274 // Otherwise, we need to return top-level package
Paul Sokolovsky91ba7a52014-02-16 02:53:44 +0200275 qstr pkg_name = qstr_from_strn(mod_str, p - mod_str);
Damien Georgecaac5422014-03-25 14:18:18 +0000276 return mp_module_get(pkg_name);
Damien Georgee09ffa12014-02-05 23:57:48 +0000277 }
Paul Sokolovskye0813292014-04-11 23:08:29 +0300278 DEBUG_printf("Module not yet loaded\n");
Damien Georgee09ffa12014-02-05 23:57:48 +0000279
Damien Georgee09ffa12014-02-05 23:57:48 +0000280 uint last = 0;
Damien George58ebde42014-05-21 20:32:59 +0100281 VSTR_FIXED(path, MICROPY_ALLOC_PATH_MAX)
Damien Georgee09ffa12014-02-05 23:57:48 +0000282 module_obj = MP_OBJ_NULL;
Paul Sokolovsky91ba7a52014-02-16 02:53:44 +0200283 mp_obj_t top_module_obj = MP_OBJ_NULL;
284 mp_obj_t outer_module_obj = MP_OBJ_NULL;
Damien Georgee09ffa12014-02-05 23:57:48 +0000285 uint i;
286 for (i = 1; i <= mod_len; i++) {
287 if (i == mod_len || mod_str[i] == '.') {
288 // create a qstr for the module name up to this depth
289 qstr mod_name = qstr_from_strn(mod_str, i);
Paul Sokolovskye0813292014-04-11 23:08:29 +0300290 DEBUG_printf("Processing module: %s\n", qstr_str(mod_name));
Paul Sokolovskyad6178b2014-05-10 19:00:03 +0300291 DEBUG_printf("Previous path: %s\n", vstr_str(&path));
Damien Georgee09ffa12014-02-05 23:57:48 +0000292
293 // find the file corresponding to the module name
294 mp_import_stat_t stat;
Damien George354d15a2014-02-06 21:11:19 +0000295 if (vstr_len(&path) == 0) {
Damien Georgee09ffa12014-02-05 23:57:48 +0000296 // first module in the dotted-name; search for a directory or file
Damien George354d15a2014-02-06 21:11:19 +0000297 stat = find_file(mod_str, i, &path);
Damien Georgee09ffa12014-02-05 23:57:48 +0000298 } else {
299 // latter module in the dotted-name; append to path
Damien George354d15a2014-02-06 21:11:19 +0000300 vstr_add_char(&path, PATH_SEP_CHAR);
301 vstr_add_strn(&path, mod_str + last, i - last);
302 stat = stat_dir_or_file(&path);
Damien Georgee09ffa12014-02-05 23:57:48 +0000303 }
Paul Sokolovskyad6178b2014-05-10 19:00:03 +0300304 DEBUG_printf("Current path: %s\n", vstr_str(&path));
Damien Georgee09ffa12014-02-05 23:57:48 +0000305
306 // fail if we couldn't find the file
307 if (stat == MP_IMPORT_STAT_NO_EXIST) {
Andrew Schellerf78cfaf2014-04-09 19:56:38 +0100308 nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ImportError, "No module named '%s'", qstr_str(mod_name)));
Damien Georgee09ffa12014-02-05 23:57:48 +0000309 }
310
Damien Georgecaac5422014-03-25 14:18:18 +0000311 module_obj = mp_module_get(mod_name);
Damien Georgee09ffa12014-02-05 23:57:48 +0000312 if (module_obj == MP_OBJ_NULL) {
313 // module not already loaded, so load it!
314
315 module_obj = mp_obj_new_module(mod_name);
316
317 if (stat == MP_IMPORT_STAT_DIR) {
Paul Sokolovskye0813292014-04-11 23:08:29 +0300318 DEBUG_printf("%s is dir\n", vstr_str(&path));
Paul Sokolovskyf9589d22014-05-10 18:46:02 +0300319 // https://docs.python.org/3.3/reference/import.html
320 // "Specifically, any module that contains a __path__ attribute is considered a package."
Paul Sokolovsky2ff3d9d2014-04-12 02:44:47 +0300321 mp_store_attr(module_obj, MP_QSTR___path__, mp_obj_new_str((byte*)vstr_str(&path), vstr_len(&path), false));
Damien George354d15a2014-02-06 21:11:19 +0000322 vstr_add_char(&path, PATH_SEP_CHAR);
323 vstr_add_str(&path, "__init__.py");
Paul Sokolovskyd3783572014-02-16 01:51:46 +0200324 if (mp_import_stat(vstr_str(&path)) != MP_IMPORT_STAT_FILE) {
Damien George280e7202014-03-15 14:33:09 +0000325 vstr_cut_tail_bytes(&path, sizeof("/__init__.py") - 1); // cut off /__init__.py
Paul Sokolovskya5854d22014-04-15 01:23:40 +0300326 printf("Notice: %s is imported as namespace package\n", vstr_str(&path));
327 } else {
328 do_load(module_obj, &path);
Paul Sokolovskyad6178b2014-05-10 19:00:03 +0300329 vstr_cut_tail_bytes(&path, sizeof("/__init__.py") - 1); // cut off /__init__.py
Damien Georgee09ffa12014-02-05 23:57:48 +0000330 }
Damien Georgee09ffa12014-02-05 23:57:48 +0000331 } else { // MP_IMPORT_STAT_FILE
Damien George354d15a2014-02-06 21:11:19 +0000332 do_load(module_obj, &path);
Paul Sokolovsky91ba7a52014-02-16 02:53:44 +0200333 // TODO: We cannot just break here, at the very least, we must execute
334 // trailer code below. But otherwise if there're remaining components,
335 // that would be (??) object path within module, not modules path within FS.
336 // break;
Damien Georgee09ffa12014-02-05 23:57:48 +0000337 }
338 }
Paul Sokolovsky91ba7a52014-02-16 02:53:44 +0200339 if (outer_module_obj != MP_OBJ_NULL) {
340 qstr s = qstr_from_strn(mod_str + last, i - last);
Damien Georged17926d2014-03-30 13:35:08 +0100341 mp_store_attr(outer_module_obj, s, module_obj);
Paul Sokolovsky91ba7a52014-02-16 02:53:44 +0200342 }
343 outer_module_obj = module_obj;
344 if (top_module_obj == MP_OBJ_NULL) {
345 top_module_obj = module_obj;
346 }
347 last = i + 1;
Damien Georgee09ffa12014-02-05 23:57:48 +0000348 }
349 }
350
351 if (i < mod_len) {
352 // we loaded a package, now need to load objects from within that package
353 // TODO
354 assert(0);
355 }
356
Paul Sokolovskyfb7f9432014-02-20 00:29:54 +0200357 // If fromlist is not empty, return leaf module
358 if (fromtuple != mp_const_none) {
359 return module_obj;
360 }
361 // Otherwise, we need to return top-level package
Paul Sokolovsky91ba7a52014-02-16 02:53:44 +0200362 return top_module_obj;
Damien George66028ab2014-01-03 14:03:48 +0000363}
Damien Georgee09ffa12014-02-05 23:57:48 +0000364
Paul Sokolovsky1d938c92014-02-04 00:46:17 +0200365MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin___import___obj, 1, 5, mp_builtin___import__);