diff --git a/Misc/NEWS.d/next/Library/2025-12-11-23-57-20.gh-issue-142606.Xd3xTx.rst b/Misc/NEWS.d/next/Library/2025-12-11-23-57-20.gh-issue-142606.Xd3xTx.rst new file mode 100644 index 00000000000000..c402bd1723d663 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2025-12-11-23-57-20.gh-issue-142606.Xd3xTx.rst @@ -0,0 +1,3 @@ +Fix two internal C API call sites where ``PyObject_CallFunction`` was +incorrectly passed an extra ``NULL`` argument in +:class:`collections.deque` and in the import machinery. diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c index 3ba48d5d9d3c64..e8e64a0bbafa78 100644 --- a/Modules/_collectionsmodule.c +++ b/Modules/_collectionsmodule.c @@ -634,7 +634,7 @@ deque_copy_impl(dequeobject *deque) (PyObject *)deque); else result = PyObject_CallFunction((PyObject *)(Py_TYPE(deque)), "Oi", - deque, old_deque->maxlen, NULL); + deque, old_deque->maxlen); if (result != NULL && !PyObject_TypeCheck(result, state->deque_type)) { PyErr_Format(PyExc_TypeError, "%.200s() must return a deque, not %.200s", diff --git a/Python/import.c b/Python/import.c index 4dd247fac27654..cb77ae331ca627 100644 --- a/Python/import.c +++ b/Python/import.c @@ -4067,7 +4067,7 @@ PyImport_Import(PyObject *module_name) Always use absolute import here. Calling for side-effect of import. */ r = PyObject_CallFunction(import, "OOOOi", module_name, globals, - globals, from_list, 0, NULL); + globals, from_list, 0); if (r == NULL) goto err; Py_DECREF(r);