diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-05-07 03:18:42 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-07 03:18:42 (GMT) |
commit | 569ca81adf0be92be8752f6cc6492117f9ef3c0b (patch) | |
tree | 53f5c060b07aa8ea57933c365206209e51ab99b3 /Modules | |
parent | ba5076f34ba3ad5252e29b55727c5c95576e7310 (diff) | |
download | cpython-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 'Modules')
-rw-r--r-- | Modules/_testcapimodule.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 0a3040f..d926ad8 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -5455,9 +5455,6 @@ pynumber_tobase(PyObject *module, PyObject *args) } -static PyObject *test_buildvalue_issue38913(PyObject *, PyObject *); - - static PyObject* test_set_type_size(PyObject *self, PyObject *Py_UNUSED(ignored)) { @@ -5596,6 +5593,8 @@ test_fatal_error(PyObject *self, PyObject *args) } +static PyObject *test_buildvalue_issue38913(PyObject *, PyObject *); +static PyObject *getargs_s_hash_int(PyObject *, PyObject *, PyObject*); static PyMethodDef TestMethods[] = { {"raise_exception", raise_exception, METH_VARARGS}, @@ -5703,6 +5702,8 @@ static PyMethodDef TestMethods[] = { {"getargs_s", getargs_s, METH_VARARGS}, {"getargs_s_star", getargs_s_star, METH_VARARGS}, {"getargs_s_hash", getargs_s_hash, METH_VARARGS}, + {"getargs_s_hash_int", (PyCFunction)(void(*)(void))getargs_s_hash_int, + METH_VARARGS|METH_KEYWORDS}, {"getargs_z", getargs_z, METH_VARARGS}, {"getargs_z_star", getargs_z_star, METH_VARARGS}, {"getargs_z_hash", getargs_z_hash, METH_VARARGS}, @@ -7375,3 +7376,19 @@ test_buildvalue_issue38913(PyObject *self, PyObject *Py_UNUSED(ignored)) Py_RETURN_NONE; } + +#undef PyArg_ParseTupleAndKeywords +PyAPI_FUNC(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *, + const char *, char **, ...); + +static PyObject * +getargs_s_hash_int(PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *keywords[] = {"", "x", NULL}; + const char *s; + int len; + int i = 0; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|s#i", keywords, &s, &len, &i)) + return NULL; + Py_RETURN_NONE; +} |