python / python/cpython

test_track_literals depends on a garbage collection

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

@sergey-miryanov đang làm issue này rồi.

Từ ngày 13/8/2026.

3.14 3.15 3.16 interpreter-core 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

_not_tracked_instantly() requires the tuple to be untracked without a collection. This holds for tuples created at run time, but tuple constants are created tracked and are only untracked by _PyTuple_MaybeUntrack(), which is called only from the collector.

$ ./python -c "import gc; print(gc.is_tracked((1,)))"
True

So test_track_literals passes only if a collection happens between importing the module and running the test. Under regrtest it does not:

$ ./python -m test test_tuple -m test_track_literals
AssertionError: True is not false : (1,)

while ./python -m unittest test.test_tuple.TupleTest.test_track_literals passes.

Untracking tuple constants when the code object is created would let the test keep the stronger check.

Linked PRs
  • gh-156419
  • gh-156423

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.