Minor change to LOAD_ATTR Opcode in 3.13 not documented
Personne n'a encore pris cette issue.
- 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
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- 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