heyuanjie87 5 anos atrás
pai
commit
e05ad2f552

+ 1 - 1
port/frozen_mpy.c

@@ -30,7 +30,7 @@ typedef struct _mp_obj_complex_t {
 enum {
     MP_QSTR_frozentest_dot_py = MP_QSTRnumber_of,
     MP_QSTR_uPy,
-    MP_QSTR_i,
+    //MP_QSTR_i,
 };
 
 extern const qstr_pool_t mp_qstr_const_pool;

+ 1 - 0
port/genhdr/qstrdefs.generated.h

@@ -778,6 +778,7 @@ QDEF(MP_QSTR___bases__, (const byte*)"\x03\x09" "__bases__")
 QDEF(MP_QSTR_writevto, (const byte*)"\x75\x08" "writevto")
 QDEF(MP_QSTR_do_handshake, (const byte*)"\x86\x0c" "do_handshake")
 QDEF(MP_QSTR___ne__, (const byte*)"\x0e\x06" "__ne__")
+QDEF(MP_QSTR_i, (const byte*)"\xcc\x01" "i")
 
 #if MICROPY_USER_EXTMODS
 #include "qstrdefs.user.extmods.h"

+ 3 - 3
port/modules/modfile.c

@@ -156,10 +156,10 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(fdfile_fileno_obj, fdfile_fileno);
 // Note: encoding is ignored for now; it's also not a valid kwarg for CPython's FileIO,
 // but by adding it here we can use one single mp_arg_t array for open() and FileIO's constructor
 STATIC const mp_arg_t file_open_args[] = {
-    { MP_QSTR_file, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_rom_obj = MP_ROM_PTR(&mp_const_none_obj)} },
+    { MP_QSTR_file, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_rom_obj = MP_ROM_NONE} },
     { MP_QSTR_mode, MP_ARG_OBJ, {.u_obj = MP_OBJ_NEW_QSTR(MP_QSTR_r)} },
-    { MP_QSTR_buffering, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_PTR(&mp_const_none_obj)} },
-    { MP_QSTR_encoding, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_PTR(&mp_const_none_obj)} },
+    { MP_QSTR_buffering, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_NONE} },
+    { MP_QSTR_encoding, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_NONE} },
 };
 #define FILE_OPEN_NUM_ARGS MP_ARRAY_SIZE(file_open_args)
 

+ 2 - 0
port/modules/modpyb.c

@@ -79,7 +79,9 @@ STATIC const mp_rom_map_elem_t pyb_module_globals_table[] = {
     { MP_ROM_QSTR(MP_QSTR_info), MP_ROM_PTR(&machine_info_obj) },
     { MP_ROM_QSTR(MP_QSTR_unique_id), MP_ROM_PTR(&machine_unique_id_obj) },
     { MP_ROM_QSTR(MP_QSTR_freq), MP_ROM_PTR(&machine_freq_obj) },
+    #if MICROPY_REPL_INFO
     { MP_ROM_QSTR(MP_QSTR_repl_info), MP_ROM_PTR(&pyb_set_repl_info_obj) },
+    #endif
 
     { MP_ROM_QSTR(MP_QSTR_wfi), MP_ROM_PTR(&pyb_wfi_obj) },
     { MP_ROM_QSTR(MP_QSTR_disable_irq), MP_ROM_PTR(&pyb_disable_irq_obj) },

+ 1 - 1
port/modules/modusocket.c

@@ -74,7 +74,7 @@ NORETURN static void exception_from_errno(int _errno) {
 }
 
 static inline void check_for_exceptions(void) {
-    mp_handle_pending();
+    mp_handle_pending(true);
 }
 
 static int _socket_getaddrinfo2(const mp_obj_t host, const mp_obj_t portx, struct addrinfo **resp) {

+ 4 - 4
port/mpconfigport.h

@@ -271,16 +271,16 @@
 #if MICROPY_PY_THREAD
 #define MICROPY_EVENT_POLL_HOOK \
     do { \
-        extern void mp_handle_pending(void); \
-        mp_handle_pending(); \
+        extern void mp_handle_pending(bool); \
+        mp_handle_pending(true); \
         MP_THREAD_GIL_EXIT(); \
         MP_THREAD_GIL_ENTER(); \
     } while (0);
 #else
 #define MICROPY_EVENT_POLL_HOOK \
     do { \
-        extern void mp_handle_pending(void); \
-        mp_handle_pending(); \
+        extern void mp_handle_pending(bool); \
+        mp_handle_pending(true); \
         rt_thread_delay(1); \
     } while (0);
 #endif

+ 1 - 1
port/mphalport.c

@@ -90,7 +90,7 @@ void mp_hal_delay_us(mp_uint_t us) {
         if (dt >= dtick) {
             break;
         }
-        mp_handle_pending();
+        mp_handle_pending(true);
     }
 }
 

+ 1 - 1
port/mpthreadport.c

@@ -101,7 +101,7 @@ mp_state_thread_t *mp_thread_get_state(void) {
     return (mp_state_thread_t *)(rt_thread_self()->user_data);
 }
 
-void mp_thread_set_state(void *state) {
+void mp_thread_set_state(mp_state_thread_t *state) {
     rt_thread_self()->user_data = (rt_uint32_t)state;
 }