Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f6d1f1f

Browse files
committed
Fix some compilation warnings when using gcc (-Wmaybe-uninitialized).
1 parent 2545411 commit f6d1f1f

1 file changed

Lines changed: 17 additions & 17 deletions

File tree

Objects/unicodeobject.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3566,6 +3566,7 @@ PyUnicode_DecodeLocaleAndSize(const char *str, Py_ssize_t len,
35663566
return unicode;
35673567

35683568
decode_error:
3569+
reason = NULL;
35693570
errmsg = strerror(errno);
35703571
assert(errmsg != NULL);
35713572

@@ -3576,10 +3577,9 @@ PyUnicode_DecodeLocaleAndSize(const char *str, Py_ssize_t len,
35763577
if (wstr != NULL) {
35773578
reason = PyUnicode_FromWideChar(wstr, errlen);
35783579
PyMem_RawFree(wstr);
3579-
} else
3580-
errmsg = NULL;
3580+
}
35813581
}
3582-
if (errmsg == NULL)
3582+
if (reason == NULL)
35833583
reason = PyUnicode_FromString(
35843584
"mbstowcs() encountered an invalid multibyte sequence");
35853585
if (reason == NULL)
@@ -9474,7 +9474,7 @@ handle_capital_sigma(int kind, void *data, Py_ssize_t length, Py_ssize_t i)
94749474
{
94759475
Py_ssize_t j;
94769476
int final_sigma;
9477-
Py_UCS4 c;
9477+
Py_UCS4 c = 0;
94789478
/* U+03A3 is in the Final_Sigma context when, it is found like this:
94799479
94809480
\p{cased}\p{case-ignorable}*U+03A3!(\p{case-ignorable}*\p{cased})
@@ -11144,7 +11144,7 @@ interpreted as in slice notation.");
1114411144
static PyObject *
1114511145
unicode_count(PyObject *self, PyObject *args)
1114611146
{
11147-
PyObject *substring;
11147+
PyObject *substring = NULL;
1114811148
Py_ssize_t start = 0;
1114911149
Py_ssize_t end = PY_SSIZE_T_MAX;
1115011150
PyObject *result;
@@ -11332,9 +11332,9 @@ Return -1 on failure.");
1133211332
static PyObject *
1133311333
unicode_find(PyObject *self, PyObject *args)
1133411334
{
11335-
PyObject *substring;
11336-
Py_ssize_t start;
11337-
Py_ssize_t end;
11335+
PyObject *substring = NULL;
11336+
Py_ssize_t start = 0;
11337+
Py_ssize_t end = 0;
1133811338
Py_ssize_t result;
1133911339

1134011340
if (!stringlib_parse_args_finds_unicode("find", args, &substring,
@@ -11420,9 +11420,9 @@ static PyObject *
1142011420
unicode_index(PyObject *self, PyObject *args)
1142111421
{
1142211422
Py_ssize_t result;
11423-
PyObject *substring;
11424-
Py_ssize_t start;
11425-
Py_ssize_t end;
11423+
PyObject *substring = NULL;
11424+
Py_ssize_t start = 0;
11425+
Py_ssize_t end = 0;
1142611426

1142711427
if (!stringlib_parse_args_finds_unicode("index", args, &substring,
1142811428
&start, &end))
@@ -12497,9 +12497,9 @@ Return -1 on failure.");
1249712497
static PyObject *
1249812498
unicode_rfind(PyObject *self, PyObject *args)
1249912499
{
12500-
PyObject *substring;
12501-
Py_ssize_t start;
12502-
Py_ssize_t end;
12500+
PyObject *substring = NULL;
12501+
Py_ssize_t start = 0;
12502+
Py_ssize_t end = 0;
1250312503
Py_ssize_t result;
1250412504

1250512505
if (!stringlib_parse_args_finds_unicode("rfind", args, &substring,
@@ -12533,9 +12533,9 @@ Like S.rfind() but raise ValueError when the substring is not found.");
1253312533
static PyObject *
1253412534
unicode_rindex(PyObject *self, PyObject *args)
1253512535
{
12536-
PyObject *substring;
12537-
Py_ssize_t start;
12538-
Py_ssize_t end;
12536+
PyObject *substring = NULL;
12537+
Py_ssize_t start = 0;
12538+
Py_ssize_t end = 0;
1253912539
Py_ssize_t result;
1254012540

1254112541
if (!stringlib_parse_args_finds_unicode("rindex", args, &substring,

0 commit comments

Comments
 (0)