Skip to content

Commit 4d0ad9e

Browse files
committed
Minor tweaks
1 parent bf69fc5 commit 4d0ad9e

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Objects/abstract.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2059,21 +2059,21 @@ PySequence_Tuple(PyObject *v)
20592059
return NULL;
20602060

20612061
PyObject *temp = PyList_New(0);
2062-
if (temp == NULL)
2063-
goto Fail;
2062+
if (temp == NULL) {
2063+
Py_DECREF(it);
2064+
return NULL;
2065+
}
20642066

20652067
/* Fill the temporary list. */
20662068
for (;;) {
20672069
PyObject *item = PyIter_Next(it);
20682070
if (item == NULL) {
20692071
if (PyErr_Occurred()) {
2070-
Py_DECREF(temp);
20712072
goto Fail;
20722073
}
20732074
break;
20742075
}
20752076
if (_PyList_AppendTakeRef((PyListObject *)temp, item)) {
2076-
Py_DECREF(temp);
20772077
goto Fail;
20782078
}
20792079
}
@@ -2083,6 +2083,7 @@ PySequence_Tuple(PyObject *v)
20832083
return result;
20842084

20852085
Fail:
2086+
Py_DECREF(temp);
20862087
Py_DECREF(it);
20872088
return NULL;
20882089
}

Objects/listobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3186,7 +3186,7 @@ _PyList_AsTupleTakeItems(PyObject *v)
31863186
Py_ssize_t size;
31873187
PyObject **items;
31883188
Py_BEGIN_CRITICAL_SECTION(self);
3189-
size = Py_SIZE(v);
3189+
size = PyList_GET_SIZE(v);
31903190
items = self->ob_item;
31913191
Py_SET_SIZE(v, 0);
31923192
self->ob_item = NULL;

0 commit comments

Comments
 (0)