python / python/cpython

Minor change to LOAD_ATTR Opcode in 3.13 not documented

Aperta
#138,402 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

docs interpreter-core
Lingua principale
Python
Stelle
77.2k
Fork
35.9k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

Documentation

The order that items are pushed to the stack by LOAD_ATTR changed in 3.13, but this is not mentioned in the dis module documentation for the LOAD_ATTR Opcode.

Further Details

For the LOAD_ATTR Opcode, the following change from 3.12 is documented

Changed in version 3.12: If the low bit of namei is set, then a NULL or self is pushed to the stack before the attribute or unbound method respectively.

And this can be seen in frameobject.c: https://github.com/python/cpython/blob/3.12/Objects/frameobject.c#L422 where NULL is pushed before Object.

However, in 3.13 this has changed, presumably due to changes to the CALL Opcode;

Changed in version 3.13: The callable now always appears at the same position on the stack.

And for LOAD_ATTR the NULL is now pushed to the stack after the attribute or unbound method.

This ordering change can be seen in frameobject.c for 3.13: https://github.com/python/cpython/blob/3.13/Objects/frameobject.c#L1280 where Object is now pushed before NULL.

Suggested Resolution

My suggestion would be adding something like this to the LOAD_ATTR documentation;

Changed in version 3.13: When the low bit of namei is set, NULL or self is pushed to the stack after the attribute or unbound method respectively.

Linked PRs
  • gh-138631

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.

Direzione di ricerca

Inizia dalla voce LOAD_ATTR nella documentazione del modulo dis di Python 3.13 e confrontane la formulazione con le posizioni di frameobject.c per la 3.12 e la 3.13 collegate nell’issue. Controlla il PR gh-138631 collegato prima di apportare modifiche; la documentazione è completa quando il cambiamento nell’ordine dello stack in 3.13 è riportato correttamente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
documentation
Tipo di issue
Documentazione
Difficoltà
1/5
Tempo stimato
Meno di un'ora
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.