@@ -155,11 +155,9 @@ STATIC void do_load_from_lexer(mp_obj_t module_obj, mp_lexer_t *lex) {
155
155
#endif
156
156
157
157
#if MICROPY_PERSISTENT_CODE_LOAD || MICROPY_MODULE_FROZEN_MPY
158
- STATIC void do_execute_raw_code (mp_obj_t module_obj , mp_raw_code_t * raw_code ) {
158
+ STATIC void do_execute_raw_code (mp_obj_t module_obj , mp_raw_code_t * raw_code , const char * filename ) {
159
159
#if MICROPY_PY___FILE__
160
- // TODO
161
- //qstr source_name = lex->source_name;
162
- //mp_store_attr(module_obj, MP_QSTR___file__, MP_OBJ_NEW_QSTR(source_name));
160
+ mp_store_attr (module_obj , MP_QSTR___file__ , MP_OBJ_NEW_QSTR (qstr_from_str (filename )));
163
161
#endif
164
162
165
163
// execute the module in its context
@@ -222,7 +220,7 @@ STATIC void do_load(mp_obj_t module_obj, vstr_t *file) {
222
220
// its data) in the list of frozen files, execute it.
223
221
#if MICROPY_MODULE_FROZEN_MPY
224
222
if (frozen_type == MP_FROZEN_MPY ) {
225
- do_execute_raw_code (module_obj , modref );
223
+ do_execute_raw_code (module_obj , modref , file_str );
226
224
return ;
227
225
}
228
226
#endif
@@ -235,7 +233,7 @@ STATIC void do_load(mp_obj_t module_obj, vstr_t *file) {
235
233
#if MICROPY_PERSISTENT_CODE_LOAD
236
234
if (file_str [file -> len - 3 ] == 'm' ) {
237
235
mp_raw_code_t * raw_code = mp_raw_code_load_file (file_str );
238
- do_execute_raw_code (module_obj , raw_code );
236
+ do_execute_raw_code (module_obj , raw_code , file_str );
239
237
return ;
240
238
}
241
239
#endif
0 commit comments