Skip to content

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Mar 11, 2025

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
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
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant