File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212#include "py/stackctrl.h"
1313#include "py/gc.h"
1414#include "py/repl.h"
15+ #include "py/mperrno.h"
1516
1617void do_str (const char * src , mp_parse_input_kind_t input_kind ) {
17- mp_lexer_t * lex = mp_lexer_new_from_str_len (MP_QSTR__lt_stdin_gt_ , src , strlen (src ), 0 );
18- if (lex == NULL ) {
19- return ;
20- }
21-
2218 nlr_buf_t nlr ;
2319 if (nlr_push (& nlr ) == 0 ) {
20+ mp_lexer_t * lex = mp_lexer_new_from_str_len (MP_QSTR__lt_stdin_gt_ , src , strlen (src ), 0 );
2421 qstr source_name = lex -> source_name ;
2522 mp_parse_tree_t parse_tree = mp_parse (lex , input_kind );
2623 mp_obj_t module_fun = mp_compile (& parse_tree , source_name , MP_EMIT_OPT_NONE , true);
@@ -47,7 +44,7 @@ void gc_collect(void) {
4744}
4845
4946mp_lexer_t * mp_lexer_new_from_file (const char * filename ) {
50- return NULL ;
47+ mp_raise_OSError ( MP_ENOENT ) ;
5148}
5249
5350mp_import_stat_t mp_import_stat (const char * path ) {
Original file line number Diff line number Diff line change 1111#include "py/runtime.h"
1212#include "py/stackctrl.h"
1313#include "py/gc.h"
14- #include "py/repl .h"
14+ #include "py/mperrno .h"
1515
1616#include "tinytest.h"
1717#include "tinytest_macros.h"
@@ -24,13 +24,9 @@ inline void do_str(const char *src) {
2424 gc_init (heap , (char * )heap + HEAP_SIZE );
2525 mp_init ();
2626
27- mp_lexer_t * lex = mp_lexer_new_from_str_len (MP_QSTR__lt_stdin_gt_ , src , strlen (src ), 0 );
28- if (lex == NULL ) {
29- tt_abort_msg ("Lexer initialization error" );
30- }
31-
3227 nlr_buf_t nlr ;
3328 if (nlr_push (& nlr ) == 0 ) {
29+ mp_lexer_t * lex = mp_lexer_new_from_str_len (MP_QSTR__lt_stdin_gt_ , src , strlen (src ), 0 );
3430 qstr source_name = lex -> source_name ;
3531 mp_parse_tree_t parse_tree = mp_parse (lex , MP_PARSE_FILE_INPUT );
3632 mp_obj_t module_fun = mp_compile (& parse_tree , source_name , MP_EMIT_OPT_NONE , false);
@@ -80,7 +76,7 @@ void gc_collect(void) {
8076}
8177
8278mp_lexer_t * mp_lexer_new_from_file (const char * filename ) {
83- return NULL ;
79+ mp_raise_OSError ( MP_ENOENT ) ;
8480}
8581
8682mp_import_stat_t mp_import_stat (const char * path ) {
You can’t perform that action at this time.
0 commit comments