gh-68114: Fix handling for removed PyArg_ParseTuple 'w' formatters (GH-8204)

Co-authored-by: Joe Jevnik <joe@quantopian.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
This commit is contained in:
Joe Jevnik 2024-04-23 07:15:15 -04:00 committed by GitHub
parent e17cd1fbfd
commit eb927e9fc8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 146 additions and 17 deletions

View file

@ -2641,6 +2641,11 @@ skipitem(const char **p_format, va_list *p_va, int flags)
if (p_va != NULL) {
(void) va_arg(*p_va, char **);
}
if (c == 'w' && *format != '*')
{
/* after 'w', only '*' is allowed */
goto err;
}
if (*format == '#') {
if (p_va != NULL) {
(void) va_arg(*p_va, Py_ssize_t *);