python / python/cpython

_Py_TryIncrefCompareStackRef incorrectly listed as non-escaping in cases generator

Aperta
#129,452 1 commento 0 reazioni 1 assegnatario Vedi su GitHub

@DinoV ci sta già lavorando.

Dal 29/1/2025.

topic-free-threading type-bug
Lingua principale
Python
Stelle
77.2k
Fork
35.9k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

Bug report

Bug description:

(This came up during the faster-cpython meeting, filing a bug so we don't forget.)

_Py_TryIncrefCompareStackRef and _Py_TryIncrefCompare are currently listed as non-escaping in the bytecode cases generator (https://github.com/python/cpython/blob/99ed3025fe8fa9079b4c1eac01c5af62caa98c15/Tools/cases_generator/analyzer.py#L635), but they can in fact escape (in the DECREF path when we're no longer sure the object we INCREF'ed is a correct object, since it may have been a pointer to a new object in re-used memory). _Py_TryIncrefCompare isn't currently used in bytecodes.c, but _Py_TryIncrefCompareStackRef is used in LOAD_ATTR specializations, which are consequently incorrectly flagged as non-escaping (and also can also theoretically cause crashes because of the missing spilling).

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

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.