Skip to content

gh-111178: Change Argument Clinic signature for METH_METHOD - #131102

Closed
vstinner wants to merge 1 commit into
python:mainfrom
vstinner:clinic_size_nargs
Closed

vstinner wants to merge 1 commit into
python:mainfrom
vstinner:clinic_size_nargs

Conversation

@vstinner

@vstinner vstinner commented Mar 11, 2025 •

Copy link
Copy Markdown
Member

Replace "Py_ssize_t nargs" with "size_t nargs" for METH_METHOD|METH_FASTCALL functions to fix an undefined behavior.

Replace "Py_ssize_t nargs" with "size_t nargs" for
METH_METHOD|METH_FASTCALL functions to fix an undefined behavior.
@vstinner

Copy link
Copy Markdown
Member Author

Oh, there is a new compiler warning:

In file included from ../cpython-ro-srcdir/Modules/_io/clinic/bufferedio.c.h:11,
                 from ../cpython-ro-srcdir/Modules/_io/bufferedio.c:2505:

../cpython-ro-srcdir/Modules/_io/clinic/bufferedio.c.h: In function ‘_io__BufferedIOBase_read’:
Warning: ../cpython-ro-srcdir/Include/internal/pycore_modsupport.h:90:16: warning: comparison of unsigned expression in ‘>= 0’ is always true [-Wtype-limits]
   90 |       (minpos) <= (nargs) && ((varpos) || (nargs) <= (maxpos)) && (args) != NULL) ? \
      |                ^~

../cpython-ro-srcdir/Modules/_io/clinic/bufferedio.c.h:154:12: note: in expansion of macro ‘_PyArg_UnpackKeywords’
  154 |     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser,
      |            ^~~~~~~~~~~~~~~~~~~~~
@vstinner

Copy link
Copy Markdown
Member Author

I abandon this PR in favor of #131135.

@vstinner vstinner closed this Mar 12, 2025
@vstinner
vstinner deleted the clinic_size_nargs branch March 12, 2025 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

1 participant