indygreg / indygreg/python-zstandard
Use multi-phase initialisation (PEP 489)
Nessuno ha ancora preso questa issue.
- Lingua principale
- C
- Stelle
- 642
- Fork
- 116
- Merge medio
- 1g 14h
- PR unite (30g)
- 5
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia leggendo PEP 489 e la documentazione sull'inizializzazione dei moduli di estensione Python, quindi individua i punti di ingresso dell'inizializzazione dei moduli di estensione nel repository. Il lavoro è completato quando i moduli di estensione utilizzano fasi di creazione ed esecuzione invece dell'inizializzazione a fase singola, il comportamento esistente dei moduli è preservato e i test pertinenti hanno esito positivo.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- c, python
- Ambito
- backend
- Tipo di issue
- Refactoring
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100