File tree Expand file tree Collapse file tree 2 files changed +19
-9
lines changed
Misc/NEWS.d/next/Core and Builtins Expand file tree Collapse file tree 2 files changed +19
-9
lines changed Original file line number Diff line number Diff line change
1
+ Port _abc extension module to multiphase initialization (:pep: `489 `).
Original file line number Diff line number Diff line change @@ -807,26 +807,35 @@ static struct PyMethodDef module_functions[] = {
807
807
{NULL , NULL } /* sentinel */
808
808
};
809
809
810
+ static int
811
+ _abc_exec (PyObject * module )
812
+ {
813
+ if (PyType_Ready (& _abc_data_type ) < 0 ) {
814
+ return -1 ;
815
+ }
816
+ _abc_data_type .tp_doc = abc_data_doc ;
817
+ return 0 ;
818
+ }
819
+
820
+ static PyModuleDef_Slot _abc_slots [] = {
821
+ {Py_mod_exec , _abc_exec },
822
+ {0 , NULL }
823
+ };
824
+
810
825
static struct PyModuleDef _abcmodule = {
811
826
PyModuleDef_HEAD_INIT ,
812
827
"_abc" ,
813
828
_abc__doc__ ,
814
- -1 ,
829
+ 0 ,
815
830
module_functions ,
816
- NULL ,
831
+ _abc_slots ,
817
832
NULL ,
818
833
NULL ,
819
834
NULL
820
835
};
821
836
822
-
823
837
PyMODINIT_FUNC
824
838
PyInit__abc (void )
825
839
{
826
- if (PyType_Ready (& _abc_data_type ) < 0 ) {
827
- return NULL ;
828
- }
829
- _abc_data_type .tp_doc = abc_data_doc ;
830
-
831
- return PyModule_Create (& _abcmodule );
840
+ return PyModuleDef_Init (& _abcmodule );
832
841
}
You can’t perform that action at this time.
0 commit comments