summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-05-07 03:18:42 (GMT)
committerGitHub <noreply@github.com>2021-05-07 03:18:42 (GMT)
commit569ca81adf0be92be8752f6cc6492117f9ef3c0b (patch)
tree53f5c060b07aa8ea57933c365206209e51ab99b3 /Python
parentba5076f34ba3ad5252e29b55727c5c95576e7310 (diff)
downloadcpython-569ca81adf0be92be8752f6cc6492117f9ef3c0b.zip
cpython-569ca81adf0be92be8752f6cc6492117f9ef3c0b.tar.gz
cpython-569ca81adf0be92be8752f6cc6492117f9ef3c0b.tar.bz2
bpo-40943: Fix skipitem() didn't raise SystemError (GH-25937)
`convertitem()` raises `SystemError` when 'GH-' is used without `PY_SSIZE_T_CLEAN`. This commit makes `skipitem()` raise it too. (cherry picked from commit 4ebf4a6bfad4afcbab3baf9c0159c7767e2a64c0) Co-authored-by: Inada Naoki <songofacandy@gmail.com>
Diffstat (limited to 'Python')
-rw-r--r--Python/getargs.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/Python/getargs.c b/Python/getargs.c
index b85b575..d5e0835 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')