diff options
| author | Damien George | 2018-06-13 12:37:49 +1000 |
|---|---|---|
| committer | Damien George | 2018-06-18 12:35:56 +1000 |
| commit | e8398a58567cc94b866d46721fd06289601f5c8a (patch) | |
| tree | 945e71ba803c72eb420b3b4d08c65cc647076027 /extmod/modujson.c | |
| parent | 6abede2ca9e221b6aefcaccbda0c89e367507df1 (diff) | |
extmod: Update to use new mp_get_stream helper.
With this patch objects are only checked that they have the stream protocol
at the start of their use as a stream, and afterwards the efficient
mp_get_stream() helper is used to extract the stream protocol C methods.
Diffstat (limited to 'extmod/modujson.c')
| -rw-r--r-- | extmod/modujson.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/extmod/modujson.c b/extmod/modujson.c index f731d7193..830b588fd 100644 --- a/extmod/modujson.c +++ b/extmod/modujson.c @@ -35,9 +35,7 @@ #if MICROPY_PY_UJSON STATIC mp_obj_t mod_ujson_dump(mp_obj_t obj, mp_obj_t stream) { - if (!MP_OBJ_IS_OBJ(stream)) { - mp_raise_TypeError(NULL); - } + mp_get_stream_raise(stream, MP_STREAM_OP_WRITE); mp_print_t print = {MP_OBJ_TO_PTR(stream), mp_stream_write_adaptor}; mp_obj_print_helper(&print, obj, PRINT_JSON); return mp_const_none; |
