]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-111178: Fix type of PyCMethod's "nargs" argument (GH-131135)
authorVictor Stinner <vstinner@python.org>
Wed, 12 Mar 2025 10:54:02 +0000 (11:54 +0100)
committerGitHub <noreply@github.com>
Wed, 12 Mar 2025 10:54:02 +0000 (11:54 +0100)
Replace "size_t nargs" with "Py_ssize_t nargs" in PyCMethod.

Include/methodobject.h
Misc/NEWS.d/next/C_API/2025-03-12-08-29-23.gh-issue-111178.Jny_YJ.rst [new file with mode: 0644]

index 39272815b127f4e8c394cc95ce6aa17464f5b962..cfff05f803309e5a747301c82c0d5a30dfa2d799 100644 (file)
@@ -24,7 +24,7 @@ typedef PyObject *(*PyCFunctionFastWithKeywords) (PyObject *,
                                                   PyObject *const *, Py_ssize_t,
                                                   PyObject *);
 typedef PyObject *(*PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *,
-                               size_t, PyObject *);
+                               Py_ssize_t, PyObject *);
 
 // For backwards compatibility. `METH_FASTCALL` was added to the stable API in
 // 3.10 alongside `_PyCFunctionFastWithKeywords` and `_PyCFunctionFast`.
diff --git a/Misc/NEWS.d/next/C_API/2025-03-12-08-29-23.gh-issue-111178.Jny_YJ.rst b/Misc/NEWS.d/next/C_API/2025-03-12-08-29-23.gh-issue-111178.Jny_YJ.rst
new file mode 100644 (file)
index 0000000..a34ec01
--- /dev/null
@@ -0,0 +1,2 @@
+Fix :c:type:`PyCMethod` API: replace ``size_t nargs`` with ``Py_ssize_t nargs``
+in :c:type:`PyCMethod`. Patch by Victor Stinner.