Commit a8d64ae3 authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #17034: Use Py_CLEAR() in stringobject.c.

parent 05fd7441
...@@ -3859,8 +3859,7 @@ PyString_Concat(register PyObject **pv, register PyObject *w) ...@@ -3859,8 +3859,7 @@ PyString_Concat(register PyObject **pv, register PyObject *w)
if (*pv == NULL) if (*pv == NULL)
return; return;
if (w == NULL || !PyString_Check(*pv)) { if (w == NULL || !PyString_Check(*pv)) {
Py_DECREF(*pv); Py_CLEAR(*pv);
*pv = NULL;
return; return;
} }
v = string_concat((PyStringObject *) *pv, w); v = string_concat((PyStringObject *) *pv, w);
...@@ -4790,12 +4789,9 @@ void ...@@ -4790,12 +4789,9 @@ void
PyString_Fini(void) PyString_Fini(void)
{ {
int i; int i;
for (i = 0; i < UCHAR_MAX + 1; i++) { for (i = 0; i < UCHAR_MAX + 1; i++)
Py_XDECREF(characters[i]); Py_CLEAR(characters[i]);
characters[i] = NULL; Py_CLEAR(nullstring);
}
Py_XDECREF(nullstring);
nullstring = NULL;
} }
void _Py_ReleaseInternedStrings(void) void _Py_ReleaseInternedStrings(void)
...@@ -4845,6 +4841,5 @@ void _Py_ReleaseInternedStrings(void) ...@@ -4845,6 +4841,5 @@ void _Py_ReleaseInternedStrings(void)
"mortal/immortal\n", mortal_size, immortal_size); "mortal/immortal\n", mortal_size, immortal_size);
Py_DECREF(keys); Py_DECREF(keys);
PyDict_Clear(interned); PyDict_Clear(interned);
Py_DECREF(interned); Py_CLEAR(interned);
interned = NULL;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment