aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/getargs.c
diff options
context:
space:
mode:
authorInada Naoki <songofacandy@gmail.com>2021-05-07 11:56:48 +0900
committerGitHub <noreply@github.com>2021-05-07 11:56:48 +0900
commit4ebf4a6bfad4afcbab3baf9c0159c7767e2a64c0 (patch)
treec704af6585b785b39027b73bf0675d92b52845bb /Python/getargs.c
parentee8e7c2fa950f88ba2c33035bea7aed7aaf0cb77 (diff)
downloadcpython-4ebf4a6bfad4afcbab3baf9c0159c7767e2a64c0.tar.gz
cpython-4ebf4a6bfad4afcbab3baf9c0159c7767e2a64c0.zip
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.
Diffstat (limited to 'Python/getargs.c')
-rw-r--r--Python/getargs.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/Python/getargs.c b/Python/getargs.c
index b85b575a147..d5e083509ef 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -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')