python / python/cpython

`_utcfromtimestamp` is undefined in `datetimetester`

Đang mở
#120,266 0 bình luận 0 reaction 1 người được giao Xem trên GitHub

@sobolevn đang làm issue này rồi.

Từ ngày 8/6/2024.

tests type-bug
Ngôn ngữ chính
Python
Star
77.2k
Fork
35.9k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

Bug report

This code cannot run correctly:

https://github.com/python/cpython/blob/55402d3232ca400ebafe4fe3bd70f252304ebe07/Lib/test/datetimetester.py#L6221-L6227

Because _utcfromtimestamp is not defined anywhere.

Introduced in https://github.com/python/cpython/commit/38dc3f28dde92b4fa6284a57f4e554991a3d9276 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
  • gh-120267

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.