bpo-1635741: Port _crypt extension module to multiphase initialization (PEP 489) (GH-18404)

This commit is contained in:
Hai Shi 2020-02-17 17:11:34 +08:00 committed by GitHub
parent d83b6600b2
commit b2b6e27bca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -0,0 +1 @@
Port _crypt extension module to multiphase initialization (:pep:`489`).

View File

@ -54,14 +54,17 @@ static PyMethodDef crypt_methods[] = {
{NULL, NULL} /* sentinel */ {NULL, NULL} /* sentinel */
}; };
static PyModuleDef_Slot _crypt_slots[] = {
{0, NULL}
};
static struct PyModuleDef cryptmodule = { static struct PyModuleDef cryptmodule = {
PyModuleDef_HEAD_INIT, PyModuleDef_HEAD_INIT,
"_crypt", "_crypt",
NULL, NULL,
-1, 0,
crypt_methods, crypt_methods,
NULL, _crypt_slots,
NULL, NULL,
NULL, NULL,
NULL NULL
@ -70,5 +73,5 @@ static struct PyModuleDef cryptmodule = {
PyMODINIT_FUNC PyMODINIT_FUNC
PyInit__crypt(void) PyInit__crypt(void)
{ {
return PyModule_Create(&cryptmodule); return PyModuleDef_Init(&cryptmodule);
} }