diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2022-07-18 15:41:22 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-18 15:41:22 (GMT) |
commit | ec6ed6681d7334f2694ca62c035a8fe6b2b60ab3 (patch) | |
tree | 52baff3512c59592f0bb305710439e875459b318 /Modules | |
parent | a914fa979e0d6043da4b591e02d2b99d26853411 (diff) | |
download | cpython-ec6ed6681d7334f2694ca62c035a8fe6b2b60ab3.zip cpython-ec6ed6681d7334f2694ca62c035a8fe6b2b60ab3.tar.gz cpython-ec6ed6681d7334f2694ca62c035a8fe6b2b60ab3.tar.bz2 |
gh-94930: skipitem() in getargs.c should return non-NULL on error (GH-94931)
(cherry picked from commit 067f0da33506f70c36a67d5f3d8d011c8dae10c9)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_testcapimodule.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 1d557fe..3467c04 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -6002,6 +6002,7 @@ settrace_to_record(PyObject *self, PyObject *list) static PyObject *negative_dictoffset(PyObject *, PyObject *); static PyObject *test_buildvalue_issue38913(PyObject *, PyObject *); static PyObject *getargs_s_hash_int(PyObject *, PyObject *, PyObject*); +static PyObject *getargs_s_hash_int2(PyObject *, PyObject *, PyObject*); static PyMethodDef TestMethods[] = { {"raise_exception", raise_exception, METH_VARARGS}, @@ -6116,6 +6117,8 @@ static PyMethodDef TestMethods[] = { {"getargs_s_hash", getargs_s_hash, METH_VARARGS}, {"getargs_s_hash_int", _PyCFunction_CAST(getargs_s_hash_int), METH_VARARGS|METH_KEYWORDS}, + {"getargs_s_hash_int2", _PyCFunction_CAST(getargs_s_hash_int2), + 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}, @@ -7835,11 +7838,27 @@ PyAPI_FUNC(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *, static PyObject * getargs_s_hash_int(PyObject *self, PyObject *args, PyObject *kwargs) { - static char *keywords[] = {"", "x", NULL}; + static char *keywords[] = {"", "", "x", NULL}; + Py_buffer buf = {NULL}; + const char *s; + int len; + int i = 0; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "w*|s#i", keywords, &buf, &s, &len, &i)) + return NULL; + PyBuffer_Release(&buf); + Py_RETURN_NONE; +} + +static PyObject * +getargs_s_hash_int2(PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *keywords[] = {"", "", "x", NULL}; + Py_buffer buf = {NULL}; const char *s; int len; int i = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|s#i", keywords, &s, &len, &i)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "w*|(s#)i", keywords, &buf, &s, &len, &i)) return NULL; + PyBuffer_Release(&buf); Py_RETURN_NONE; } |