[Python-checkins] bpo-1635741: Port _string module to multi-phase init (GH-22148)

Victor Stinner webhook-mailer at python.org
Tue Sep 8 09:33:36 EDT 2020


https://github.com/python/cpython/commit/bb083d33f7ffe93cee9e1f63d1e526dc81a6e34f
commit: bb083d33f7ffe93cee9e1f63d1e526dc81a6e34f
branch: master
author: Victor Stinner <vstinner at python.org>
committer: GitHub <noreply at github.com>
date: 2020-09-08T15:33:08+02:00
summary:

bpo-1635741: Port _string module to multi-phase init (GH-22148)

Port the _string extension module to the multi-phase initialization
API (PEP 489).

files:
A Misc/NEWS.d/next/Library/2020-09-08-13-51-16.bpo-1635741.wkPeoT.rst
M Objects/unicodeobject.c

diff --git a/Misc/NEWS.d/next/Library/2020-09-08-13-51-16.bpo-1635741.wkPeoT.rst b/Misc/NEWS.d/next/Library/2020-09-08-13-51-16.bpo-1635741.wkPeoT.rst
new file mode 100644
index 0000000000000..972d69b94b6ba
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2020-09-08-13-51-16.bpo-1635741.wkPeoT.rst
@@ -0,0 +1,2 @@
+Port the ``_string`` extension module to the multi-phase initialization API
+(:pep:`489`).
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 82e09ad05fcd1..fd0e8e008adae 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -16243,20 +16243,16 @@ static PyMethodDef _string_methods[] = {
 
 static struct PyModuleDef _string_module = {
     PyModuleDef_HEAD_INIT,
-    "_string",
-    PyDoc_STR("string helper module"),
-    0,
-    _string_methods,
-    NULL,
-    NULL,
-    NULL,
-    NULL
+    .m_name = "_string",
+    .m_doc = PyDoc_STR("string helper module"),
+    .m_size = 0,
+    .m_methods = _string_methods,
 };
 
 PyMODINIT_FUNC
 PyInit__string(void)
 {
-    return PyModule_Create(&_string_module);
+    return PyModuleDef_Init(&_string_module);
 }
 
 



More information about the Python-checkins mailing list