python / python/cpython

Minor change to LOAD_ATTR Opcode in 3.13 not documented

Ouverte
#138,402 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

docs interpreter-core
Langage dominant
Python
Étoiles
77.2k
Forks
36k
Métriques de merge des PR
Métriques de PR en attente

Description

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

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par l’entrée LOAD_ATTR dans la documentation du module dis de Python 3.13 et comparez sa formulation avec les emplacements de frameobject.c des versions 3.12 et 3.13 liés dans l’issue. Consultez le PR gh-138631 lié avant d’apporter des modifications ; la documentation est terminée lorsque le changement d’ordre de la pile en 3.13 est correctement consigné.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
python
Domaine
documentation
Type d'issue
Documentation
Difficulté
1/5
Temps estimé
Moins d'une heure
Activité
À l'abandon
Clarté
Clairement spécifiée
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.