summaryrefslogtreecommitdiff
path: root/py/objnamedtuple.c
diff options
context:
space:
mode:
authormicroDev <70126934+microDev1@users.noreply.github.com>2020-11-24 12:24:48 +0530
committermicroDev <70126934+microDev1@users.noreply.github.com>2020-11-24 12:24:48 +0530
commitbbe13490b55bceed477b28c7ed4256db69cca84b (patch)
treeb7f28f67626dcd76196500294e13ac3b703f89a0 /py/objnamedtuple.c
parent6ff24410ebe9e75456b9d5d64f37fbe019caf42c (diff)
parentebdc48ae22589080300da249f416bd55f1c121bd (diff)
Merge branch 'main' into nvm-s2
Diffstat (limited to 'py/objnamedtuple.c')
-rw-r--r--py/objnamedtuple.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/py/objnamedtuple.c b/py/objnamedtuple.c
index ab2f2f3c0..8b595da57 100644
--- a/py/objnamedtuple.c
+++ b/py/objnamedtuple.c
@@ -102,17 +102,17 @@ mp_obj_t namedtuple_make_new(const mp_obj_type_t *type_in, size_t n_args, const
n_kw = kw_args->used;
}
if (n_args + n_kw != num_fields) {
- if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) {
+ #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE
mp_arg_error_terse_mismatch();
- } else if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_NORMAL) {
+ #elif MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_NORMAL
mp_raise_TypeError_varg(
translate("function takes %d positional arguments but %d were given"),
num_fields, n_args + n_kw);
- } else if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_DETAILED) {
+ #else
mp_raise_TypeError_varg(
translate("%q() takes %d positional arguments but %d were given"),
type->base.name, num_fields, n_args + n_kw);
- }
+ #endif
}
// Create a tuple and set the type to this namedtuple
@@ -128,20 +128,20 @@ mp_obj_t namedtuple_make_new(const mp_obj_type_t *type_in, size_t n_args, const
qstr kw = mp_obj_str_get_qstr(kw_args->table[i].key);
size_t id = mp_obj_namedtuple_find_field(type, kw);
if (id == (size_t)-1) {
- if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) {
+ #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE
mp_arg_error_terse_mismatch();
- } else {
+ #else
mp_raise_TypeError_varg(
translate("unexpected keyword argument '%q'"), kw);
- }
+ #endif
}
if (tuple->items[id] != MP_OBJ_NULL) {
- if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) {
+ #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE
mp_arg_error_terse_mismatch();
- } else {
+ #else
mp_raise_TypeError_varg(
translate("function got multiple values for argument '%q'"), kw);
- }
+ #endif
}
tuple->items[id] = kw_args->table[i].value;
}