Switch arg check back to allow ignored args for strings

This commit is contained in:
Scott Shawcroft 2019-10-14 19:59:23 -07:00
parent 9435e01f9e
commit 1610d06bb4
No known key found for this signature in database
GPG Key ID: 9349BC7E64B1921E
1 changed files with 4 additions and 4 deletions

View File

@ -212,10 +212,6 @@ STATIC mp_obj_t bytes_make_new(const mp_obj_type_t *type_in, size_t n_args, cons
return mp_const_empty_bytes;
}
if (n_args > 1) {
goto wrong_args;
}
if (MP_OBJ_IS_STR(args[0])) {
if (n_args < 2 || n_args > 3) {
goto wrong_args;
@ -242,6 +238,10 @@ STATIC mp_obj_t bytes_make_new(const mp_obj_type_t *type_in, size_t n_args, cons
return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr);
}
if (n_args > 1) {
goto wrong_args;
}
// check if __bytes__ exists, and if so delegate to it
mp_obj_t dest[2];
mp_load_method_maybe(args[0], MP_QSTR___bytes__, dest);