]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-96641: Do not expose `KeyWrapper` in `_functoolsmodule.c` (gh-96642)
authorNikita Sobolev <mail@sobolevn.me>
Wed, 7 Sep 2022 11:13:07 +0000 (14:13 +0300)
committerGitHub <noreply@github.com>
Wed, 7 Sep 2022 11:13:07 +0000 (20:13 +0900)
Misc/NEWS.d/next/Core and Builtins/2022-09-07-13-38-37.gh-issue-96641.wky0Fc.rst [new file with mode: 0644]
Modules/_functoolsmodule.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2022-09-07-13-38-37.gh-issue-96641.wky0Fc.rst b/Misc/NEWS.d/next/Core and Builtins/2022-09-07-13-38-37.gh-issue-96641.wky0Fc.rst
new file mode 100644 (file)
index 0000000..51faca8
--- /dev/null
@@ -0,0 +1 @@
+Do not expose ``KeyWrapper`` in :mod:`_functools`.
index c6d6ca934e9c473b7e3194a05517e490660227d9..3abb7fd710aeb4f5a853da191349e0f9c1a5649e 100644 (file)
@@ -1471,9 +1471,8 @@ _functools_exec(PyObject *module)
     if (state->keyobject_type == NULL) {
         return -1;
     }
-    if (PyModule_AddType(module, state->keyobject_type) < 0) {
-        return -1;
-    }
+    // keyobject_type is used only internally.
+    // So we don't expose it in module namespace.
 
     state->lru_list_elem_type = (PyTypeObject *)PyType_FromModuleAndSpec(
         module, &lru_list_elem_type_spec, NULL);