File tree 1 file changed +10
-9
lines changed 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -863,7 +863,7 @@ static PyObject *
863
863
tee_fromiterable (PyObject * iterable )
864
864
{
865
865
teeobject * to ;
866
- PyObject * it = NULL ;
866
+ PyObject * it ;
867
867
868
868
it = PyObject_GetIter (iterable );
869
869
if (it == NULL )
@@ -873,21 +873,22 @@ tee_fromiterable(PyObject *iterable)
873
873
goto done ;
874
874
}
875
875
876
- to = PyObject_GC_New (teeobject , & tee_type );
877
- if (to == NULL )
878
- goto done ;
879
- to -> dataobj = (teedataobject * )teedataobject_newinternal (it );
880
- if (!to -> dataobj ) {
881
- PyObject_GC_Del (to );
876
+ PyObject * dataobj = teedataobject_newinternal (it );
877
+ if (!dataobj ) {
882
878
to = NULL ;
883
879
goto done ;
884
880
}
885
-
881
+ to = PyObject_GC_New (teeobject , & tee_type );
882
+ if (to == NULL ) {
883
+ Py_DECREF (dataobj );
884
+ goto done ;
885
+ }
886
+ to -> dataobj = (teedataobject * )dataobj ;
886
887
to -> index = 0 ;
887
888
to -> weakreflist = NULL ;
888
889
PyObject_GC_Track (to );
889
890
done :
890
- Py_XDECREF (it );
891
+ Py_DECREF (it );
891
892
return (PyObject * )to ;
892
893
}
893
894
You can’t perform that action at this time.
0 commit comments