summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-09-04 16:51:55 +0100
committerDamien George <damien.p.george@gmail.com>2015-09-04 16:51:55 +0100
commit42cec5c893c4055c9c3a4b224bbf65bf0dfd9f49 (patch)
treed9e21dc9e361e7e471dad8c3f124cfe470e8907d /py
parent55b11e6d38731ffb1a7378f936c940c61aef8743 (diff)
downloadmicropython-42cec5c893c4055c9c3a4b224bbf65bf0dfd9f49.tar.gz
micropython-42cec5c893c4055c9c3a4b224bbf65bf0dfd9f49.zip
py/objstr: Check for keyword args before checking for no posn args.
Otherwise something like bytes(abc=123) will succeed.
Diffstat (limited to 'py')
-rw-r--r--py/objstr.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/py/objstr.c b/py/objstr.c
index 704fa07e1d..ed61d17f89 100644
--- a/py/objstr.c
+++ b/py/objstr.c
@@ -172,16 +172,16 @@ mp_obj_t mp_obj_str_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw,
STATIC mp_obj_t bytes_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
(void)type_in;
- if (n_args == 0) {
- return mp_const_empty_bytes;
- }
-
#if MICROPY_CPYTHON_COMPAT
if (n_kw != 0) {
mp_arg_error_unimpl_kw();
}
#endif
+ if (n_args == 0) {
+ return mp_const_empty_bytes;
+ }
+
if (MP_OBJ_IS_STR(args[0])) {
if (n_args < 2 || n_args > 3) {
goto wrong_args;