diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-01-19-11-06-30.bpo-1635741.0mjsfm.rst b/Misc/NEWS.d/next/Core and Builtins/2020-01-19-11-06-30.bpo-1635741.0mjsfm.rst new file mode 100644 index 00000000000..10fc23bcfa1 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2020-01-19-11-06-30.bpo-1635741.0mjsfm.rst @@ -0,0 +1 @@ +Port _codecs extension module to multiphase initialization (:pep:`489`). \ No newline at end of file diff --git a/Modules/_codecsmodule.c b/Modules/_codecsmodule.c index a8ffb699557..952072102d5 100644 --- a/Modules/_codecsmodule.c +++ b/Modules/_codecsmodule.c @@ -1039,13 +1039,17 @@ static PyMethodDef _codecs_functions[] = { {NULL, NULL} /* sentinel */ }; +static PyModuleDef_Slot _codecs_slots[] = { + {0, NULL} +}; + static struct PyModuleDef codecsmodule = { PyModuleDef_HEAD_INIT, "_codecs", NULL, - -1, + 0, _codecs_functions, - NULL, + _codecs_slots, NULL, NULL, NULL @@ -1054,5 +1058,5 @@ static struct PyModuleDef codecsmodule = { PyMODINIT_FUNC PyInit__codecs(void) { - return PyModule_Create(&codecsmodule); + return PyModuleDef_Init(&codecsmodule); }