diff options
| author | Scott Shawcroft <scott@tannewt.org> | 2019-10-14 19:59:23 -0700 |
|---|---|---|
| committer | Scott Shawcroft <scott@tannewt.org> | 2019-10-14 19:59:23 -0700 |
| commit | 1610d06bb438961722c558bd695d6964c76cc080 (patch) | |
| tree | 8487f3a8606ca2309ddfdff15f9d07e39ebda68d | |
| parent | 9435e01f9e46ed212adf592b008f3036e16c0fbd (diff) | |
Switch arg check back to allow ignored args for strings
| -rw-r--r-- | py/objstr.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/py/objstr.c b/py/objstr.c index 853868d21..fde264681 100644 --- a/py/objstr.c +++ b/py/objstr.c @@ -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); |
