diff options
author | Inada Naoki <songofacandy@gmail.com> | 2019-03-23 12:04:40 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-23 12:04:40 (GMT) |
commit | d3c72a223a5f771f964fc34557c55eb5bfa0f5a0 (patch) | |
tree | c0dec4fc435af520724b012b1d7b7b9bc8a0466a /Python/getargs.c | |
parent | d60f658fc0278f3fcdadec8ddcab35b8ae03e1d1 (diff) | |
download | cpython-d3c72a223a5f771f964fc34557c55eb5bfa0f5a0.zip cpython-d3c72a223a5f771f964fc34557c55eb5bfa0f5a0.tar.gz cpython-d3c72a223a5f771f964fc34557c55eb5bfa0f5a0.tar.bz2 |
bpo-36381: warn when no PY_SSIZE_T_CLEAN defined (GH-12473)
We will remove int support from 3.10 or 4.0.
Diffstat (limited to 'Python/getargs.c')
-rw-r--r-- | Python/getargs.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/Python/getargs.c b/Python/getargs.c index e50f9b5..59f0fda 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -681,7 +681,13 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, /* For # codes */ #define FETCH_SIZE int *q=NULL;Py_ssize_t *q2=NULL;\ if (flags & FLAG_SIZE_T) q2=va_arg(*p_va, Py_ssize_t*); \ - else q=va_arg(*p_va, int*); + else { \ + if (PyErr_WarnEx(PyExc_DeprecationWarning, \ + "PY_SSIZE_T_CLEAN will be required for '#' formats", 1)) { \ + return NULL; \ + } \ + q=va_arg(*p_va, int*); \ + } #define STORE_SIZE(s) \ if (flags & FLAG_SIZE_T) \ *q2=s; \ @@ -2591,8 +2597,13 @@ skipitem(const char **p_format, va_list *p_va, int flags) if (p_va != NULL) { if (flags & FLAG_SIZE_T) (void) va_arg(*p_va, Py_ssize_t *); - else + else { + if (PyErr_WarnEx(PyExc_DeprecationWarning, + "PY_SSIZE_T_CLEAN will be required for '#' formats", 1)) { + return NULL; + } (void) va_arg(*p_va, int *); + } } format++; } else if ((c == 's' || c == 'z' || c == 'y' || c == 'w') |