stream: Return errno value as first arg of OSError exception.
This is CPython-compatible convention established yet in acb13886fc837a1bb9.
diff --git a/py/stream.c b/py/stream.c
index c1430e3..862f3e6 100644
--- a/py/stream.c
+++ b/py/stream.c
@@ -110,7 +110,7 @@
}
break;
}
- nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_OSError, "[Errno %d]", error));
+ nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(error)));
}
if (out_sz < more_bytes) {
@@ -178,7 +178,7 @@
// this as EOF.
return mp_const_none;
}
- nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_OSError, "[Errno %d]", error));
+ nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(error)));
} else {
mp_obj_t s = mp_obj_new_str_of_type(STREAM_CONTENT_TYPE(o->type->stream_p), buf, out_sz); // will reallocate to use exact size
m_free(buf, sz);
@@ -204,7 +204,7 @@
// see abobe.
return mp_const_none;
}
- nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_OSError, "[Errno %d]", error));
+ nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(error)));
} else {
return MP_OBJ_NEW_SMALL_INT(out_sz);
}
@@ -240,7 +240,7 @@
}
break;
}
- nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_OSError, "[Errno %d]", error));
+ nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(error)));
}
if (out_sz == 0) {
break;
@@ -293,7 +293,7 @@
mp_uint_t out_sz = o->type->stream_p->read(o, p, 1, &error);
if (out_sz == MP_STREAM_ERROR) {
- nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_OSError, "[Errno %d]", error));
+ nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(error)));
}
if (out_sz == 0) {
// Back out previously added byte