29
29
#include "py/pairheap.h"
30
30
#include "py/mphal.h"
31
31
32
- #if MICROPY_PY_UASYNCIO
32
+ #if MICROPY_PY_ASYNCIO
33
33
34
34
// Used when task cannot be guaranteed to be non-NULL.
35
35
#define TASK_PAIRHEAP (task ) ((task) ? &(task)->pairheap : NULL)
@@ -155,8 +155,8 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
155
155
/******************************************************************************/
156
156
// Task class
157
157
158
- // This is the core uasyncio context with cur_task, _task_queue and CancelledError.
159
- STATIC mp_obj_t uasyncio_context = MP_OBJ_NULL ;
158
+ // This is the core asyncio context with cur_task, _task_queue and CancelledError.
159
+ STATIC mp_obj_t asyncio_context = MP_OBJ_NULL ;
160
160
161
161
STATIC mp_obj_t task_make_new (const mp_obj_type_t * type , size_t n_args , size_t n_kw , const mp_obj_t * args ) {
162
162
mp_arg_check_num (n_args , n_kw , 1 , 2 , false );
@@ -168,7 +168,7 @@ STATIC mp_obj_t task_make_new(const mp_obj_type_t *type, size_t n_args, size_t n
168
168
self -> state = TASK_STATE_RUNNING_NOT_WAITED_ON ;
169
169
self -> ph_key = MP_OBJ_NEW_SMALL_INT (0 );
170
170
if (n_args == 2 ) {
171
- uasyncio_context = args [1 ];
171
+ asyncio_context = args [1 ];
172
172
}
173
173
return MP_OBJ_FROM_PTR (self );
174
174
}
@@ -186,7 +186,7 @@ STATIC mp_obj_t task_cancel(mp_obj_t self_in) {
186
186
return mp_const_false ;
187
187
}
188
188
// Can't cancel self (not supported yet).
189
- mp_obj_t cur_task = mp_obj_dict_get (uasyncio_context , MP_OBJ_NEW_QSTR (MP_QSTR_cur_task ));
189
+ mp_obj_t cur_task = mp_obj_dict_get (asyncio_context , MP_OBJ_NEW_QSTR (MP_QSTR_cur_task ));
190
190
if (self_in == cur_task ) {
191
191
mp_raise_msg (& mp_type_RuntimeError , MP_ERROR_TEXT ("can't cancel self" ));
192
192
}
@@ -195,7 +195,7 @@ STATIC mp_obj_t task_cancel(mp_obj_t self_in) {
195
195
self = MP_OBJ_TO_PTR (self -> data );
196
196
}
197
197
198
- mp_obj_t _task_queue = mp_obj_dict_get (uasyncio_context , MP_OBJ_NEW_QSTR (MP_QSTR__task_queue ));
198
+ mp_obj_t _task_queue = mp_obj_dict_get (asyncio_context , MP_OBJ_NEW_QSTR (MP_QSTR__task_queue ));
199
199
200
200
// Reschedule Task as a cancelled task.
201
201
mp_obj_t dest [3 ];
@@ -218,7 +218,7 @@ STATIC mp_obj_t task_cancel(mp_obj_t self_in) {
218
218
task_queue_push (2 , dest );
219
219
}
220
220
221
- self -> data = mp_obj_dict_get (uasyncio_context , MP_OBJ_NEW_QSTR (MP_QSTR_CancelledError ));
221
+ self -> data = mp_obj_dict_get (asyncio_context , MP_OBJ_NEW_QSTR (MP_QSTR_CancelledError ));
222
222
223
223
return mp_const_true ;
224
224
}
@@ -278,7 +278,7 @@ STATIC mp_obj_t task_iternext(mp_obj_t self_in) {
278
278
nlr_raise (self -> data );
279
279
} else {
280
280
// Put calling task on waiting queue.
281
- mp_obj_t cur_task = mp_obj_dict_get (uasyncio_context , MP_OBJ_NEW_QSTR (MP_QSTR_cur_task ));
281
+ mp_obj_t cur_task = mp_obj_dict_get (asyncio_context , MP_OBJ_NEW_QSTR (MP_QSTR_cur_task ));
282
282
mp_obj_t args [2 ] = { self -> state , cur_task };
283
283
task_queue_push (2 , args );
284
284
// Set calling task's data to this task that it waits on, to double-link it.
@@ -302,20 +302,20 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
302
302
);
303
303
304
304
/******************************************************************************/
305
- // C-level uasyncio module
305
+ // C-level asyncio module
306
306
307
- STATIC const mp_rom_map_elem_t mp_module_uasyncio_globals_table [] = {
308
- { MP_ROM_QSTR (MP_QSTR___name__ ), MP_ROM_QSTR (MP_QSTR__uasyncio ) },
307
+ STATIC const mp_rom_map_elem_t mp_module_asyncio_globals_table [] = {
308
+ { MP_ROM_QSTR (MP_QSTR___name__ ), MP_ROM_QSTR (MP_QSTR__asyncio ) },
309
309
{ MP_ROM_QSTR (MP_QSTR_TaskQueue ), MP_ROM_PTR (& task_queue_type ) },
310
310
{ MP_ROM_QSTR (MP_QSTR_Task ), MP_ROM_PTR (& task_type ) },
311
311
};
312
- STATIC MP_DEFINE_CONST_DICT (mp_module_uasyncio_globals , mp_module_uasyncio_globals_table );
312
+ STATIC MP_DEFINE_CONST_DICT (mp_module_asyncio_globals , mp_module_asyncio_globals_table );
313
313
314
- const mp_obj_module_t mp_module_uasyncio = {
314
+ const mp_obj_module_t mp_module_asyncio = {
315
315
.base = { & mp_type_module },
316
- .globals = (mp_obj_dict_t * )& mp_module_uasyncio_globals ,
316
+ .globals = (mp_obj_dict_t * )& mp_module_asyncio_globals ,
317
317
};
318
318
319
- MP_REGISTER_MODULE (MP_QSTR__uasyncio , mp_module_uasyncio );
319
+ MP_REGISTER_MODULE (MP_QSTR__asyncio , mp_module_asyncio );
320
320
321
- #endif // MICROPY_PY_UASYNCIO
321
+ #endif // MICROPY_PY_ASYNCIO
0 commit comments