Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions shared-bindings/audiomp3/MP3Decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ static void check_for_deinit(audiomp3_mp3file_obj_t *self) {
//|
// Provided by context manager helper.

//| file: typing.BinaryIO
//| """File to play back."""
//| file: Union[str, typing.BinaryIO]
//| """The name of a mp3 file (preferred) or an already opened mp3 file."""
//|
static mp_obj_t audiomp3_mp3file_obj_get_file(mp_obj_t self_in) {
audiomp3_mp3file_obj_t *self = MP_OBJ_TO_PTR(self_in);
Expand All @@ -152,6 +152,9 @@ MP_DEFINE_CONST_FUN_OBJ_1(audiomp3_mp3file_get_file_obj, audiomp3_mp3file_obj_ge
static mp_obj_t audiomp3_mp3file_obj_set_file(mp_obj_t self_in, mp_obj_t stream) {
audiomp3_mp3file_obj_t *self = MP_OBJ_TO_PTR(self_in);
check_for_deinit(self);
if (mp_obj_is_str(stream)) {
stream = mp_call_function_2(MP_OBJ_FROM_PTR(&mp_builtin_open_obj), stream, MP_ROM_QSTR(MP_QSTR_rb));
}
const mp_stream_p_t *stream_p = mp_get_stream_raise(stream, MP_STREAM_OP_READ);

if (stream_p->is_text) {
Expand Down