Skip to content

Commit bce5718

Browse files
committed
pathches: Modify the parameter check of time.mktime.
Signed-off-by: lbuque <[email protected]>
1 parent d754e47 commit bce5718

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

m5stack/patches/0006-modtime-add-timezone-method.patch

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,15 @@ Index: micropython/extmod/modtime.c
5656
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_time_localtime_obj, 0, 1, time_localtime);
5757

5858
// mktime()
59+
@@ -86,7 +111,7 @@ static mp_obj_t time_mktime(mp_obj_t tup
60+
mp_obj_get_array(tuple, &len, &elem);
61+
62+
// localtime generates a tuple of len 8. CPython uses 9, so we accept both.
63+
- if (len < 8 || len > 9) {
64+
+ if (len < 6) {
65+
mp_raise_TypeError(MP_ERROR_TEXT("mktime needs a tuple of length 8 or 9"));
66+
}
67+
5968
@@ -200,7 +225,7 @@ static const mp_rom_map_elem_t mp_module
6069
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_time) },
6170

0 commit comments

Comments
 (0)