Page MenuHomeSoftware Heritage

Fix TimestampWithTimezone.from_dict() on datetimes before 1970 with non-integer seconds
ClosedPublic

Authored by vlorentz on Wed, Jan 12, 2:27 PM.

Diff Detail

Repository
rDMOD Data model
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D6924 (id=25090)

Rebasing onto 94b00d6877...

Current branch diff-target is up to date.
Changes applied before test
commit ff6594b59db208b5112e8a5de8fd62433466f16c
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Wed Jan 12 14:27:15 2022 +0100

    Fix TimestampWithTimezone.from_dict() on datetimes before 1970 with non-integer seconds in TZ offsets
    
    `int()` rounds negative numbers up.

See https://jenkins.softwareheritage.org/job/DMOD/job/tests-on-diff/442/ for more details.

vlorentz retitled this revision from Fix TimestampWithTimezone.from_dict() on datetimes before 1970 with non-integer seconds in TZ offsets to Fix TimestampWithTimezone.from_dict() on datetimes before 1970 with non-integer seconds.Wed, Jan 12, 2:39 PM
vlorentz edited the summary of this revision. (Show Details)

Build is green

Patch application report for D6924 (id=25093)

Rebasing onto 94b00d6877...

Current branch diff-target is up to date.
Changes applied before test
commit ccf2c5dfcbc9a1444e144d60601c4d384080e8aa
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Wed Jan 12 14:27:15 2022 +0100

    Fix TimestampWithTimezone.from_dict() on datetimes before 1970 with non-integer seconds

See https://jenkins.softwareheritage.org/job/DMOD/job/tests-on-diff/443/ for more details.

minimize the diff by restoring the algo based on .replace()

Build is green

Patch application report for D6924 (id=25094)

Rebasing onto 94b00d6877...

Current branch diff-target is up to date.
Changes applied before test
commit dbf185c3b36c4d79d4214bbf29425c58ba4aa6ba
Author: Valentin Lorentz <vlorentz@softwareheritage.org>
Date:   Wed Jan 12 14:27:15 2022 +0100

    Fix TimestampWithTimezone.from_dict() on datetimes before 1970 with non-integer seconds

See https://jenkins.softwareheritage.org/job/DMOD/job/tests-on-diff/444/ for more details.

olasd added a subscriber: olasd.

Thanks!

swh/model/model.py
489–491

Maybe that'd be worth a (separate) warning if the remainder is non-zero...

This revision is now accepted and ready to land.Wed, Jan 12, 2:47 PM
swh/model/model.py
489–491

indeed, I'll add it later