Set default arguments in _testlimitedcapi/unicode.c (#159380)

Some optional arguments had no default value leading to undefined
behavior if they were omitted.
This commit is contained in:
Victor Stinner authored and GitHub committed 2026-10-14 14:52:44 +02:00
1 parent 9f52b443c0
commit e96d943d7d
1 file changed
+6 -6
+6 -6
View File
@@ -993,7 +993,7 @@ unicode_encodecodepage(PyObject *self, PyObject *args)
{
int code_page;
PyObject *unicode;
const char *errors;
const char *errors = NULL;
if (!PyArg_ParseTuple(args, "iO|z", &code_page, &unicode, &errors))
return NULL;
@@ -1010,7 +1010,7 @@ unicode_decodelocaleandsize(PyObject *self, PyObject *args)
{
const char *data;
Py_ssize_t size;
const char *errors;
const char *errors = NULL;
if (!PyArg_ParseTuple(args, "y#|z", &data, &size, &errors))
return NULL;
@@ -1024,7 +1024,7 @@ unicode_decodelocale(PyObject *self, PyObject *args)
{
const char *data;
Py_ssize_t size;
const char *errors;
const char *errors = NULL;
if (!PyArg_ParseTuple(args, "y#|z", &data, &size, &errors))
return NULL;
@@ -1037,7 +1037,7 @@ static PyObject *
unicode_encodelocale(PyObject *self, PyObject *args)
{
PyObject *unicode;
const char *errors;
const char *errors = NULL;
if (!PyArg_ParseTuple(args, "O|z", &unicode, &errors))
return NULL;
@@ -1331,7 +1331,7 @@ unicode_comparewithasciistring(PyObject *self, PyObject *args)
{
PyObject *left;
const char *right = NULL;
Py_ssize_t right_len;
Py_ssize_t right_len = 0;
int result;
if (!PyArg_ParseTuple(args, "O|y#", &left, &right, &right_len))
@@ -1370,7 +1370,7 @@ unicode_equaltoutf8andsize(PyObject *self, PyObject *args)
{
PyObject *left;
const char *right = NULL;
Py_ssize_t right_len;
Py_ssize_t right_len = 0;
Py_ssize_t size = -100;
int result;