summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2025-03-12 10:54:02 (GMT)
committerGitHub <noreply@github.com>2025-03-12 10:54:02 (GMT)
commit4dcbe06fd264b3f9c0b26831f19d211a48c52286 (patch)
treefac36a137891b61309b33b62d70addfd503ad427
parente0637cebe5bf863897f2e89dfcb76be0015c1877 (diff)
downloadcpython-4dcbe06fd264b3f9c0b26831f19d211a48c52286.zip
cpython-4dcbe06fd264b3f9c0b26831f19d211a48c52286.tar.gz
cpython-4dcbe06fd264b3f9c0b26831f19d211a48c52286.tar.bz2
gh-111178: Fix type of PyCMethod's "nargs" argument (GH-131135)
Replace "size_t nargs" with "Py_ssize_t nargs" in PyCMethod.
-rw-r--r--Include/methodobject.h2
-rw-r--r--Misc/NEWS.d/next/C_API/2025-03-12-08-29-23.gh-issue-111178.Jny_YJ.rst2
2 files changed, 3 insertions, 1 deletions
diff --git a/Include/methodobject.h b/Include/methodobject.h
index 3927281..cfff05f 100644
--- a/Include/methodobject.h
+++ b/Include/methodobject.h
@@ -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
index 0000000..a34ec01
--- /dev/null
+++ b/Misc/NEWS.d/next/C_API/2025-03-12-08-29-23.gh-issue-111178.Jny_YJ.rst
@@ -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.