Skip to content

Commit 8911ef5

Browse files
Issue #17034: Use Py_CLEAR() in bytesobject.c.
2 parents 8f59021 + d357a3f commit 8911ef5

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

‎Objects/bytesobject.c‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2754,8 +2754,7 @@ PyBytes_Concat(register PyObject **pv, register PyObject *w)
27542754
if (*pv == NULL)
27552755
return;
27562756
if (w == NULL) {
2757-
Py_DECREF(*pv);
2758-
*pv = NULL;
2757+
Py_CLEAR(*pv);
27592758
return;
27602759
}
27612760
v = bytes_concat(*pv, w);
@@ -2819,12 +2818,9 @@ void
28192818
PyBytes_Fini(void)
28202819
{
28212820
int i;
2822-
for (i = 0; i < UCHAR_MAX + 1; i++) {
2823-
Py_XDECREF(characters[i]);
2824-
characters[i] = NULL;
2825-
}
2826-
Py_XDECREF(nullstring);
2827-
nullstring = NULL;
2821+
for (i = 0; i < UCHAR_MAX + 1; i++)
2822+
Py_CLEAR(characters[i]);
2823+
Py_CLEAR(nullstring);
28282824
}
28292825

28302826
/*********************** Bytes Iterator ****************************/

0 commit comments

Comments
 (0)