Skip to content

Commit b473d0a

Browse files
committed
py: bytes(), str(): Add NotImplementedError for kwargs.
Addresses adafruit#567.
1 parent 47d3bd3 commit b473d0a

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

py/objstr.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ STATIC void str_print(void (*print)(void *env, const char *fmt, ...), void *env,
108108
}
109109

110110
STATIC mp_obj_t str_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args) {
111+
#if MICROPY_CPYTHON_COMPAT
112+
if (n_kw != 0) {
113+
mp_arg_error_unimpl_kw();
114+
}
115+
#endif
116+
111117
switch (n_args) {
112118
case 0:
113119
return MP_OBJ_NEW_QSTR(MP_QSTR_);
@@ -146,6 +152,12 @@ STATIC mp_obj_t bytes_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const m
146152
return mp_const_empty_bytes;
147153
}
148154

155+
#if MICROPY_CPYTHON_COMPAT
156+
if (n_kw != 0) {
157+
mp_arg_error_unimpl_kw();
158+
}
159+
#endif
160+
149161
if (MP_OBJ_IS_STR(args[0])) {
150162
if (n_args < 2 || n_args > 3) {
151163
goto wrong_args;

0 commit comments

Comments
 (0)