]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-1635741: Port _codecs extension module to multiphase initialization (PEP 489...
authorHai Shi <shihai1992@gmail.com>
Tue, 11 Feb 2020 11:16:38 +0000 (05:16 -0600)
committerGitHub <noreply@github.com>
Tue, 11 Feb 2020 11:16:38 +0000 (03:16 -0800)
https://bugs.python.org/issue1635741

Misc/NEWS.d/next/Core and Builtins/2020-01-19-11-06-30.bpo-1635741.0mjsfm.rst [new file with mode: 0644]
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 (file)
index 0000000..10fc23b
--- /dev/null
@@ -0,0 +1 @@
+Port _codecs extension module to multiphase initialization (:pep:`489`).
\ No newline at end of file
index a8ffb699557abf84216bf996bd996bdaf0129006..952072102d5d8d1941c095d06eb8dde15ec3564c 100644 (file)
@@ -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);
 }