indygreg / indygreg/python-zstandard
Use multi-phase initialisation (PEP 489)
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- C
- Sterne
- 642
- Forks
- 116
- Ø Merge
- 1 T. 14 Std.
- Gemergte PRs (30 T.)
- 5
Beschreibung
Hello,
Please consider adopting multi-phase init for your Python extension modules. In short, multi-phase makes extension modules behave more like pure-Python modules and means that the import system can determine what a capabilities a module has before executing it.
Multi-phase initialisation was introduced in [PEP 489](https://peps.python.org/pep-0489/) for Python 3.5. It replaces the previous 'single-phase' mechanism by splitting the module creation process into creation and execution phases. Quoting from [the documentation](https://docs.python.org/3/c-api/module.html#multi-phase-initialization):
> Extension modules created this way behave more like Python modules: the initialization is split between the creation phase, when the module object is created, and the execution phase, when it is populated. The distinction is similar to the `__new__()` and `__init__()` methods of classes.
It is the preferred mechanism for extension module initialisation, and there is a proposal to [deprecate](https://discuss.python.org/t/89262/45) single phase init.
Thanks,
Adam
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 mit dem Lesen von PEP 489 und der Dokumentation zur Initialisierung von Python-Erweiterungsmodulen und finde anschließend die Einstiegspunkte zur Initialisierung der Erweiterungsmodule im Repository. Als abgeschlossen gilt die Aufgabe, wenn die Erweiterungsmodule Erstellungs- und Ausführungsphasen anstelle einer einstufigen Initialisierung verwenden, das bestehende Modulverhalten erhalten bleibt und die relevanten Tests erfolgreich sind.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- c, python
- Bereich
- backend
- Issue-Typ
- Refactoring
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100