diff options
| author | Scott Shawcroft <scott@tannewt.org> | 2018-03-31 09:57:25 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-03-31 09:57:25 -0700 |
| commit | 3215b85568af98987c8d54af4e691637a74e91bc (patch) | |
| tree | 8d9013d646deb1fbde1c6f5eef0c85a78958b851 /py | |
| parent | d65ea992bf252da993480c590e005be5fd55c2e0 (diff) | |
| parent | 853f7ac4d001d2098a4f25305e235f5d0e7c26c8 (diff) | |
Merge pull request #728 from jepler/double-splat-crash-circuitpython
py/bc: Turn assertion error into exception
Diffstat (limited to 'py')
| -rw-r--r-- | py/bc.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -190,6 +190,13 @@ void mp_setup_code_state(mp_code_state_t *code_state, size_t n_args, size_t n_kw for (size_t i = 0; i < n_kw; i++) { // the keys in kwargs are expected to be qstr objects mp_obj_t wanted_arg_name = kwargs[2 * i]; + if(MP_UNLIKELY(!MP_OBJ_IS_QSTR(wanted_arg_name))) { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE + mp_raise_TypeError("unexpected keyword argument"); + #else + mp_raise_TypeError("keywords must be strings"); + #endif + } for (size_t j = 0; j < n_pos_args + n_kwonly_args; j++) { if (wanted_arg_name == arg_names[j]) { if (code_state->state[n_state - 1 - j] != MP_OBJ_NULL) { |
