diff options
author | Inada Naoki <songofacandy@gmail.com> | 2023-05-31 09:38:55 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-31 09:38:55 (GMT) |
commit | adccff3b3f9fbdb58cb4b8fde92456e6dd078af0 (patch) | |
tree | 3eea6fd8543a6a8e800b4792ad7c276598f3afb5 /Modules | |
parent | f90d3f68db720bd6d0deda8cc0030339ccd43858 (diff) | |
download | cpython-adccff3b3f9fbdb58cb4b8fde92456e6dd078af0.zip cpython-adccff3b3f9fbdb58cb4b8fde92456e6dd078af0.tar.gz cpython-adccff3b3f9fbdb58cb4b8fde92456e6dd078af0.tar.bz2 |
gh-104922: Make `PY_SSIZE_T_CLEAN` not mandatory again (#105051)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_testcapi/getargs.c | 40 | ||||
-rw-r--r-- | Modules/_testcapimodule.c | 47 |
2 files changed, 0 insertions, 87 deletions
diff --git a/Modules/_testcapi/getargs.c b/Modules/_testcapi/getargs.c index aa20131..95ef2d2 100644 --- a/Modules/_testcapi/getargs.c +++ b/Modules/_testcapi/getargs.c @@ -816,44 +816,6 @@ test_s_code(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}; - 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, "w*|(s#)i", keywords, - &buf, &s, &len, &i)) - { - return NULL; - } - PyBuffer_Release(&buf); - Py_RETURN_NONE; -} - static PyObject * gh_99240_clear_args(PyObject *self, PyObject *args) { @@ -906,8 +868,6 @@ static PyMethodDef test_methods[] = { {"getargs_positional_only_and_keywords", _PyCFunction_CAST(getargs_positional_only_and_keywords), METH_VARARGS|METH_KEYWORDS}, {"getargs_s", getargs_s, METH_VARARGS}, {"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_s_star", getargs_s_star, METH_VARARGS}, {"getargs_tuple", getargs_tuple, METH_VARARGS}, {"getargs_u", getargs_u, METH_VARARGS}, diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 66c1cba..86b6dc3 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -3266,8 +3266,6 @@ test_atexit(PyObject *self, PyObject *Py_UNUSED(args)) } -static PyObject *test_buildvalue_issue38913(PyObject *, PyObject *); - static PyMethodDef TestMethods[] = { {"set_errno", set_errno, METH_VARARGS}, {"test_config", test_config, METH_NOARGS}, @@ -3297,7 +3295,6 @@ static PyMethodDef TestMethods[] = { {"getbuffer_with_null_view", getbuffer_with_null_view, METH_O}, {"PyBuffer_SizeFromFormat", test_PyBuffer_SizeFromFormat, METH_VARARGS}, {"test_buildvalue_N", test_buildvalue_N, METH_NOARGS}, - {"test_buildvalue_issue38913", test_buildvalue_issue38913, METH_NOARGS}, {"test_get_statictype_slots", test_get_statictype_slots, METH_NOARGS}, {"test_get_type_name", test_get_type_name, METH_NOARGS}, {"test_get_type_qualname", test_get_type_qualname, METH_NOARGS}, @@ -4067,47 +4064,3 @@ PyInit__testcapi(void) PyState_AddModule(m, &_testcapimodule); return m; } - -/* Test the C API exposed when PY_SSIZE_T_CLEAN is not defined */ - -#undef Py_BuildValue -PyAPI_FUNC(PyObject *) Py_BuildValue(const char *, ...); - -static PyObject * -test_buildvalue_issue38913(PyObject *self, PyObject *Py_UNUSED(ignored)) -{ - PyObject *res; - const char str[] = "string"; - const Py_UNICODE unicode[] = L"unicode"; - assert(!PyErr_Occurred()); - - res = Py_BuildValue("(s#O)", str, 1, Py_None); - assert(res == NULL); - if (!PyErr_ExceptionMatches(PyExc_SystemError)) { - return NULL; - } - PyErr_Clear(); - - res = Py_BuildValue("(z#O)", str, 1, Py_None); - assert(res == NULL); - if (!PyErr_ExceptionMatches(PyExc_SystemError)) { - return NULL; - } - PyErr_Clear(); - - res = Py_BuildValue("(y#O)", str, 1, Py_None); - assert(res == NULL); - if (!PyErr_ExceptionMatches(PyExc_SystemError)) { - return NULL; - } - PyErr_Clear(); - - res = Py_BuildValue("(u#O)", unicode, 1, Py_None); - assert(res == NULL); - if (!PyErr_ExceptionMatches(PyExc_SystemError)) { - return NULL; - } - PyErr_Clear(); - - Py_RETURN_NONE; -} |