File tree 1 file changed +11
-5
lines changed
1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -140,20 +140,26 @@ test_frozenset_add_in_capi(PyObject *self, PyObject *Py_UNUSED(obj))
140
140
}
141
141
PyObject * num = PyLong_FromLong (1 );
142
142
if (num == NULL ) {
143
- return NULL ;
143
+ goto error ;
144
144
}
145
145
if (PySet_Add (fs , num ) < 0 ) {
146
- return NULL ;
146
+ goto error ;
147
147
}
148
148
int contains = PySet_Contains (fs , num );
149
149
if (contains < 0 ) {
150
- return NULL ;
150
+ goto error ;
151
151
}
152
152
else if (contains == 0 ) {
153
- PyErr_SetString (PyExc_ValueError , "set does not contain expected value" );
154
- return NULL ;
153
+ goto unexpected ;
155
154
}
156
155
Py_RETURN_NONE ;
156
+
157
+ unexpected :
158
+ PyErr_SetString (PyExc_ValueError , "set does not contain expected value" );
159
+ error :
160
+ Py_DECREF (fs );
161
+ Py_XDECREF (num );
162
+ return NULL ;
157
163
}
158
164
159
165
static PyMethodDef test_methods [] = {
You can’t perform that action at this time.
0 commit comments