Extend and improve `LOAD_COMMON_CONSTANT`
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 77.2k
- Forks
- 35.9k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
Currently LOAD_COMMON_CONSTANT only loads 7 not-so-common constants and does so fairly inefficiently.
It could be improved in two ways:
- Add some more constants, especially
None, but also"",True,Falseand-1 Make the constants that it does load both statically allocated and immortal to avoid the pointer chasing and incref operation. Onlyanyandallwould need changing.
After some consideration, I think it best to leave the common constants table per interpreter, and not statically allocate them.
- The changes to
anyandallmay be breaking. - We also need to handle
AssertionErrorandNotImplementedErrorwill be tricky to make static
They should all be immortal though, and stored as _PyStackRefs not PyObject *s.
Linked PRs
- gh-148971
- gh-149625
- gh-149688
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne am Einstiegspunkt LOAD_COMMON_CONSTANT und prüfe, wie die Tabelle der interpreterbezogenen gemeinsamen Konstanten Werte speichert und zurückgibt. Prüfe die verknüpften PRs, bevor du das Design änderst, insbesondere die Überlegungen zu _PyStackRef, zur Unsterblichkeit und zu any/all. Als erledigt gilt, wenn die vereinbarten gemeinsamen Konstanten, einschließlich None, der leeren Zeichenkette, True, False und -1, ohne den abgelehnten Ansatz der statischen Allokation behandelt werden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- compilers
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 25/100