python / python/cpython

test_track_literals depends on a garbage collection

Aperta
#155,728 7 commenti 0 reazioni 1 assegnatario Vedi su GitHub

@sergey-miryanov ci sta già lavorando.

Dal 13/8/2026.

3.14 3.15 3.16 interpreter-core tests type-bug
Lingua principale
Python
Stelle
77.2k
Fork
35.9k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.