summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHai Shi <shihai1992@gmail.com>2020-02-17 09:11:34 (GMT)
committerGitHub <noreply@github.com>2020-02-17 09:11:34 (GMT)
commitb2b6e27bcab44e914d0a0b170e915d6f1604a76d (patch)
tree48abe7582980ba9c73e63a989dc6f5df4065ba65
parentd83b6600b25487e4ebffd7949d0f478de9538875 (diff)
downloadcpython-b2b6e27bcab44e914d0a0b170e915d6f1604a76d.zip
cpython-b2b6e27bcab44e914d0a0b170e915d6f1604a76d.tar.gz
cpython-b2b6e27bcab44e914d0a0b170e915d6f1604a76d.tar.bz2
bpo-1635741: Port _crypt extension module to multiphase initialization (PEP 489) (GH-18404)
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2020-02-07-12-57-40.bpo-1635741.ySW6gq.rst1
-rw-r--r--Modules/_cryptmodule.c9
2 files changed, 7 insertions, 3 deletions
diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-02-07-12-57-40.bpo-1635741.ySW6gq.rst b/Misc/NEWS.d/next/Core and Builtins/2020-02-07-12-57-40.bpo-1635741.ySW6gq.rst
new file mode 100644
index 0000000..6b35bdc
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2020-02-07-12-57-40.bpo-1635741.ySW6gq.rst
@@ -0,0 +1 @@
+Port _crypt extension module to multiphase initialization (:pep:`489`). \ No newline at end of file
diff --git a/Modules/_cryptmodule.c b/Modules/_cryptmodule.c
index 00c1f4f..a95f55a 100644
--- a/Modules/_cryptmodule.c
+++ b/Modules/_cryptmodule.c
@@ -54,14 +54,17 @@ static PyMethodDef crypt_methods[] = {
{NULL, NULL} /* sentinel */
};
+static PyModuleDef_Slot _crypt_slots[] = {
+ {0, NULL}
+};
static struct PyModuleDef cryptmodule = {
PyModuleDef_HEAD_INIT,
"_crypt",
NULL,
- -1,
+ 0,
crypt_methods,
- NULL,
+ _crypt_slots,
NULL,
NULL,
NULL
@@ -70,5 +73,5 @@ static struct PyModuleDef cryptmodule = {
PyMODINIT_FUNC
PyInit__crypt(void)
{
- return PyModule_Create(&cryptmodule);
+ return PyModuleDef_Init(&cryptmodule);
}