diff options
Diffstat (limited to 'py/stream.c')
-rw-r--r-- | py/stream.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/py/stream.c b/py/stream.c index f3487cc6ed..59877d7242 100644 --- a/py/stream.c +++ b/py/stream.c @@ -16,7 +16,7 @@ STATIC mp_obj_t stream_read(uint n_args, const mp_obj_t *args) { struct _mp_obj_base_t *o = (struct _mp_obj_base_t *)args[0]; if (o->type->stream_p.read == NULL) { // CPython: io.UnsupportedOperation, OSError subclass - nlr_jump(mp_obj_new_exception_msg(MP_QSTR_OSError, "Operation not supported")); + nlr_jump(mp_obj_new_exception_msg(&mp_type_OSError, "Operation not supported")); } machine_int_t sz; @@ -27,7 +27,7 @@ STATIC mp_obj_t stream_read(uint n_args, const mp_obj_t *args) { int error; machine_int_t out_sz = o->type->stream_p.read(o, buf, sz, &error); if (out_sz == -1) { - nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_OSError, "[Errno %d]", error)); + nlr_jump(mp_obj_new_exception_msg_varg(&mp_type_OSError, "[Errno %d]", error)); } else { mp_obj_t s = mp_obj_new_str(buf, out_sz, false); // will reallocate to use exact size m_free(buf, sz); @@ -39,7 +39,7 @@ STATIC mp_obj_t stream_write(mp_obj_t self_in, mp_obj_t arg) { struct _mp_obj_base_t *o = (struct _mp_obj_base_t *)self_in; if (o->type->stream_p.write == NULL) { // CPython: io.UnsupportedOperation, OSError subclass - nlr_jump(mp_obj_new_exception_msg(MP_QSTR_OSError, "Operation not supported")); + nlr_jump(mp_obj_new_exception_msg(&mp_type_OSError, "Operation not supported")); } uint sz; @@ -47,7 +47,7 @@ STATIC mp_obj_t stream_write(mp_obj_t self_in, mp_obj_t arg) { int error; machine_int_t out_sz = o->type->stream_p.write(self_in, buf, sz, &error); if (out_sz == -1) { - nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_OSError, "[Errno %d]", error)); + nlr_jump(mp_obj_new_exception_msg_varg(&mp_type_OSError, "[Errno %d]", error)); } else { // http://docs.python.org/3/library/io.html#io.RawIOBase.write // "None is returned if the raw stream is set not to block and no single byte could be readily written to it." @@ -62,7 +62,7 @@ STATIC mp_obj_t stream_readall(mp_obj_t self_in) { struct _mp_obj_base_t *o = (struct _mp_obj_base_t *)self_in; if (o->type->stream_p.read == NULL) { // CPython: io.UnsupportedOperation, OSError subclass - nlr_jump(mp_obj_new_exception_msg(MP_QSTR_OSError, "Operation not supported")); + nlr_jump(mp_obj_new_exception_msg(&mp_type_OSError, "Operation not supported")); } int total_size = 0; @@ -74,7 +74,7 @@ STATIC mp_obj_t stream_readall(mp_obj_t self_in) { while (true) { machine_int_t out_sz = o->type->stream_p.read(self_in, p, current_read, &error); if (out_sz == -1) { - nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_OSError, "[Errno %d]", error)); + nlr_jump(mp_obj_new_exception_msg_varg(&mp_type_OSError, "[Errno %d]", error)); } if (out_sz == 0) { break; @@ -88,7 +88,7 @@ STATIC mp_obj_t stream_readall(mp_obj_t self_in) { p = vstr_extend(vstr, current_read); if (p == NULL) { // TODO - nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_OSError/*MP_QSTR_RuntimeError*/, "Out of memory")); + nlr_jump(mp_obj_new_exception_msg_varg(&mp_type_OSError/*&mp_type_RuntimeError*/, "Out of memory")); } } } @@ -103,7 +103,7 @@ STATIC mp_obj_t stream_unbuffered_readline(uint n_args, const mp_obj_t *args) { struct _mp_obj_base_t *o = (struct _mp_obj_base_t *)args[0]; if (o->type->stream_p.read == NULL) { // CPython: io.UnsupportedOperation, OSError subclass - nlr_jump(mp_obj_new_exception_msg(MP_QSTR_OSError, "Operation not supported")); + nlr_jump(mp_obj_new_exception_msg(&mp_type_OSError, "Operation not supported")); } machine_int_t max_size = -1; @@ -123,12 +123,12 @@ STATIC mp_obj_t stream_unbuffered_readline(uint n_args, const mp_obj_t *args) { char *p = vstr_add_len(vstr, 1); if (p == NULL) { // TODO - nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_OSError/*MP_QSTR_RuntimeError*/, "Out of memory")); + nlr_jump(mp_obj_new_exception_msg_varg(&mp_type_OSError/*&mp_type_RuntimeError*/, "Out of memory")); } machine_int_t out_sz = o->type->stream_p.read(o, p, 1, &error); if (out_sz == -1) { - nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_OSError, "[Errno %d]", error)); + nlr_jump(mp_obj_new_exception_msg_varg(&mp_type_OSError, "[Errno %d]", error)); } if (out_sz == 0) { // Back out previously added byte |