summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohamed Koubaa <koubaa.m@gmail.com>2020-09-09 03:28:48 (GMT)
committerGitHub <noreply@github.com>2020-09-09 03:28:48 (GMT)
commit3ff6975e2c0af0399467f234b2e307cc76efcfa9 (patch)
tree1e68ccb397c18a525a8f149d2ed36269ccae3a1c
parent58de1dd6a8677bd213802c19204b827cb7134695 (diff)
downloadcpython-3ff6975e2c0af0399467f234b2e307cc76efcfa9.zip
cpython-3ff6975e2c0af0399467f234b2e307cc76efcfa9.tar.gz
cpython-3ff6975e2c0af0399467f234b2e307cc76efcfa9.tar.bz2
bpo-1635741: port scproxy to multi-phase init (GH-22164)
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2020-09-08-20-39-43.bpo-1635741.jiXmyT.rst2
-rw-r--r--Modules/_scproxy.c22
2 files changed, 11 insertions, 13 deletions
diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-09-08-20-39-43.bpo-1635741.jiXmyT.rst b/Misc/NEWS.d/next/Core and Builtins/2020-09-08-20-39-43.bpo-1635741.jiXmyT.rst
new file mode 100644
index 0000000..17752b2
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2020-09-08-20-39-43.bpo-1635741.jiXmyT.rst
@@ -0,0 +1,2 @@
+Port the :mod:`_scproxy` extension module to multi-phase initialization
+(:pep:`489`).
diff --git a/Modules/_scproxy.c b/Modules/_scproxy.c
index dbee3f7..4c1f1aa 100644
--- a/Modules/_scproxy.c
+++ b/Modules/_scproxy.c
@@ -231,21 +231,18 @@ static PyMethodDef mod_methods[] = {
{ 0, 0, 0, 0 }
};
+static PyModuleDef_Slot _scproxy_slots[] = {
+ {0, NULL}
+};
-
-static struct PyModuleDef mod_module = {
+static struct PyModuleDef _scproxy_module = {
PyModuleDef_HEAD_INIT,
- "_scproxy",
- NULL,
- -1,
- mod_methods,
- NULL,
- NULL,
- NULL,
- NULL
+ .m_name = "_scproxy",
+ .m_size = 0,
+ .m_methods = mod_methods,
+ .m_slots = _scproxy_slots,
};
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -253,10 +250,9 @@ extern "C" {
PyMODINIT_FUNC
PyInit__scproxy(void)
{
- return PyModule_Create(&mod_module);
+ return PyModuleDef_Init(&_scproxy_module);
}
#ifdef __cplusplus
}
#endif
-