From f0a9589105ef592deff2a579a393e016d6e62662 Mon Sep 17 00:00:00 2001 From: Hai Shi Date: Thu, 16 Jan 2020 19:53:34 +0800 Subject: [PATCH 1/3] Port _abc extension module to multiphase initialization(PEP 489) --- Modules/_abc.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/Modules/_abc.c b/Modules/_abc.c index 7b5d4180bf8739..8747075f8e00c9 100644 --- a/Modules/_abc.c +++ b/Modules/_abc.c @@ -807,26 +807,35 @@ static struct PyMethodDef module_functions[] = { {NULL, NULL} /* sentinel */ }; +static int +_abc_exec(PyObject *module) +{ + if (PyType_Ready(&_abc_data_type) < 0) { + return -1; + } + _abc_data_type.tp_doc = abc_data_doc; + return 0; +} + +static PyModuleDef_Slot _abc_slots[] = { + {Py_mod_exec, _abc_exec}, + {0, NULL} +}; + static struct PyModuleDef _abcmodule = { PyModuleDef_HEAD_INIT, "_abc", _abc__doc__, - -1, + 0, module_functions, - NULL, + _abc_slots, NULL, NULL, NULL }; - PyMODINIT_FUNC PyInit__abc(void) { - if (PyType_Ready(&_abc_data_type) < 0) { - return NULL; - } - _abc_data_type.tp_doc = abc_data_doc; - - return PyModule_Create(&_abcmodule); + return PyModuleDef_Init(&_abcmodule); } From ba41ab9baba8d5baf6e7718e2e4f7fc2bc4a691d Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Thu, 16 Jan 2020 12:00:08 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Core and Builtins/2020-01-16-12-00-04.bpo-1635741.fuqoBG.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2020-01-16-12-00-04.bpo-1635741.fuqoBG.rst diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-01-16-12-00-04.bpo-1635741.fuqoBG.rst b/Misc/NEWS.d/next/Core and Builtins/2020-01-16-12-00-04.bpo-1635741.fuqoBG.rst new file mode 100644 index 00000000000000..f8605a72e0424a --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2020-01-16-12-00-04.bpo-1635741.fuqoBG.rst @@ -0,0 +1 @@ +Port _json extension module to multiphase initialization (:pep:`489`). \ No newline at end of file From 596ab3c8cb525290f5be77105db9ec10071c53ab Mon Sep 17 00:00:00 2001 From: Hai Shi Date: Thu, 16 Jan 2020 19:59:17 +0800 Subject: [PATCH 3/3] update news --- .../2020-01-16-12-00-04.bpo-1635741.fuqoBG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-01-16-12-00-04.bpo-1635741.fuqoBG.rst b/Misc/NEWS.d/next/Core and Builtins/2020-01-16-12-00-04.bpo-1635741.fuqoBG.rst index f8605a72e0424a..4dd37a65b0e996 100644 --- a/Misc/NEWS.d/next/Core and Builtins/2020-01-16-12-00-04.bpo-1635741.fuqoBG.rst +++ b/Misc/NEWS.d/next/Core and Builtins/2020-01-16-12-00-04.bpo-1635741.fuqoBG.rst @@ -1 +1 @@ -Port _json extension module to multiphase initialization (:pep:`489`). \ No newline at end of file +Port _abc extension module to multiphase initialization (:pep:`489`).