mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-40943: Fix skipitem() didn't raise SystemError (GH-25937)
`convertitem()` raises `SystemError` when '#' is used without `PY_SSIZE_T_CLEAN`. This commit makes `skipitem()` raise it too.
This commit is contained in:
parent
ee8e7c2fa9
commit
4ebf4a6bfa
3 changed files with 32 additions and 11 deletions
|
@ -2532,15 +2532,12 @@ skipitem(const char **p_format, va_list *p_va, int flags)
|
|||
}
|
||||
if (*format == '#') {
|
||||
if (p_va != NULL) {
|
||||
if (flags & FLAG_SIZE_T)
|
||||
(void) va_arg(*p_va, Py_ssize_t *);
|
||||
else {
|
||||
if (PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||
"PY_SSIZE_T_CLEAN will be required for '#' formats", 1)) {
|
||||
return NULL;
|
||||
}
|
||||
(void) va_arg(*p_va, int *);
|
||||
if (!(flags & FLAG_SIZE_T)) {
|
||||
PyErr_SetString(PyExc_SystemError,
|
||||
"PY_SSIZE_T_CLEAN macro must be defined for '#' formats");
|
||||
return NULL;
|
||||
}
|
||||
(void) va_arg(*p_va, Py_ssize_t *);
|
||||
}
|
||||
format++;
|
||||
} else if ((c == 's' || c == 'z' || c == 'y' || c == 'w')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue