Skip to content

_utcfromtimestamp is undefined in datetimetester #120266

@sobolevn

Description

@sobolevn

Bug report

This code cannot run correctly:

def nondst_folds(self):
"""Find all folds with the same value of isdst on both sides of the transition."""
for (_, prev_ti), (t, ti) in pairs(zip(self.ut, self.ti)):
shift = ti[0] - prev_ti[0]
if shift < ZERO and ti[1] == prev_ti[1]:
yield _utcfromtimestamp(datetime, t,), -shift, prev_ti[2], ti[2]

Because _utcfromtimestamp is not defined anywhere.

Introduced in 38dc3f2 by @pganssle

I think that this is a typo, I will send a PR.

This was introduced when datetime.utcfromtimestamp was deprecated, I propose to use a direct alternative: datetime.fromtimestamp(t, datetime.UTC)

This problem is not detected by tests, because this looks like a in-test helper for module maintainers. It is not used as of right now.

Linked PRs

Metadata

Metadata

Assignees

Labels

testsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions