use mp_get_stream_raise, it's more specific

This commit is contained in:
Jeff Epler 2021-11-20 08:53:04 -05:00
parent de455b5c4e
commit f4e68e8fae
No known key found for this signature in database
GPG Key ID: D5BF15AB975AB4DE

View File

@ -78,7 +78,7 @@ static void write_word(gifio_gifwriter_t *self, uint16_t value) {
void shared_module_gifio_gifwriter_construct(gifio_gifwriter_t *self, mp_obj_t *file, int width, int height, displayio_colorspace_t colorspace, bool loop, bool dither, bool own_file) {
self->file = file;
self->file_proto = mp_proto_get_or_throw(MP_QSTR_protocol_stream, file);
self->file_proto = mp_get_stream_raise(file, MP_STREAM_OP_WRITE | MP_STREAM_OP_IOCTL);
if (self->file_proto->is_text) {
mp_raise_TypeError(translate("file must be a file opened in byte mode"));
}