Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_utcfromtimestamp is undefined in datetimetester #120266

Open
sobolevn opened this issue Jun 8, 2024 · 0 comments
Open

_utcfromtimestamp is undefined in datetimetester #120266

sobolevn opened this issue Jun 8, 2024 · 0 comments
Assignees
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@sobolevn
Copy link
Member

sobolevn commented Jun 8, 2024

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

@sobolevn sobolevn added type-bug An unexpected behavior, bug, or error tests Tests in the Lib/test dir labels Jun 8, 2024
@sobolevn sobolevn self-assigned this Jun 8, 2024
sobolevn added a commit to sobolevn/cpython that referenced this issue Jun 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
1 participant