diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-01-18-10-49-17.bpo-1635741.ee-6-z.rst b/Misc/NEWS.d/next/Core and Builtins/2020-01-18-10-49-17.bpo-1635741.ee-6-z.rst new file mode 100644 index 00000000000000..855009ad8769f2 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2020-01-18-10-49-17.bpo-1635741.ee-6-z.rst @@ -0,0 +1 @@ +Port _bisect extension module to multiphase initialization (:pep:`489`). \ No newline at end of file diff --git a/Modules/_bisectmodule.c b/Modules/_bisectmodule.c index 461a11f5099db3..1c9f9931484233 100644 --- a/Modules/_bisectmodule.c +++ b/Modules/_bisectmodule.c @@ -260,14 +260,17 @@ having to sort the list after each insertion. For long lists of items with\n\ expensive comparison operations, this can be an improvement over the more\n\ common approach.\n"); +static PyModuleDef_Slot _bisect_slots[] = { + {0, NULL} +}; static struct PyModuleDef _bisectmodule = { PyModuleDef_HEAD_INIT, "_bisect", module_doc, - -1, + 0, bisect_methods, - NULL, + _bisect_slots, NULL, NULL, NULL @@ -276,5 +279,5 @@ static struct PyModuleDef _bisectmodule = { PyMODINIT_FUNC PyInit__bisect(void) { - return PyModule_Create(&_bisectmodule); + return PyModuleDef_Init(&_bisectmodule); }