[Python-checkins] bpo-1635741: Port _codecs extension module to multiphase initialization (PEP 489) (GH-18065)

Hai Shi webhook-mailer at python.org
Tue Feb 11 06:16:46 EST 2020


https://github.com/python/cpython/commit/1ea45ae257971ee7b648e3b031603a31fc059f81
commit: 1ea45ae257971ee7b648e3b031603a31fc059f81
branch: master
author: Hai Shi <shihai1992 at gmail.com>
committer: GitHub <noreply at github.com>
date: 2020-02-11T03:16:38-08:00
summary:

bpo-1635741: Port _codecs extension module to multiphase initialization (PEP 489) (GH-18065)



https://bugs.python.org/issue1635741

files:
A Misc/NEWS.d/next/Core and Builtins/2020-01-19-11-06-30.bpo-1635741.0mjsfm.rst
M Modules/_codecsmodule.c

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 0000000000000..10fc23bcfa117
--- /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 a8ffb699557ab..952072102d5d8 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);
 }



More information about the Python-checkins mailing list