Merge pull request #4762 from Neradoc/small-timestamps-if-epoch-2000

time.localtime: low timestamps when epoch is 2000
This commit is contained in:
Dan Halbert 2021-07-15 15:08:09 -04:00 committed by GitHub
commit 698a392cf1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -250,7 +250,11 @@ STATIC mp_obj_t time_localtime(size_t n_args, const mp_obj_t *args) {
mp_int_t secs = mp_obj_get_int(arg);
#if MICROPY_EPOCH_IS_1970
if (secs < 0 || (mp_uint_t)secs < TIMEUTILS_SECONDS_1970_TO_2000) {
#else
if (secs < 0) {
#endif
mp_raise_msg(&mp_type_OverflowError, translate("timestamp out of range for platform time_t"));
}