Skip to content

Commit dc25bc0

Browse files
committed
cleanup
1 parent 082e340 commit dc25bc0

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

Modules/_functoolsmodule.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -466,18 +466,18 @@ partial_vectorcall(PyObject *self, PyObject *const *args,
466466
val = args[nargs + i];
467467
int contains = PyDict_Contains(partial_keywords, key);
468468
if (contains < 0) {
469-
goto error;
469+
goto clean_stack;
470470
}
471471
else if (contains == 1) {
472472
if (pto_kw_merged == NULL) {
473473
pto_kw_merged = PyDict_Copy(partial_keywords);
474474
if (pto_kw_merged == NULL) {
475-
goto error;
475+
goto clean_stack;
476476
}
477477
}
478478
if (PyDict_SetItem(pto_kw_merged, key, val) < 0) {
479479
Py_DECREF(pto_kw_merged);
480-
goto error;
480+
goto clean_stack;
481481
}
482482
}
483483
else {
@@ -493,7 +493,7 @@ partial_vectorcall(PyObject *self, PyObject *const *args,
493493
tot_kwnames = PyTuple_New(tot_nkwds - n_merges);
494494
if (tot_kwnames == NULL) {
495495
Py_XDECREF(pto_kw_merged);
496-
goto error;
496+
goto clean_stack;
497497
}
498498
for (Py_ssize_t i = 0; i < n_tail; ++i) {
499499
key = Py_NewRef(stack[tot_nargskw + i]);
@@ -522,11 +522,8 @@ partial_vectorcall(PyObject *self, PyObject *const *args,
522522
tmp_stack = PyMem_Realloc(stack, (tot_nargskw - n_merges) * sizeof(PyObject *));
523523
if (tmp_stack == NULL) {
524524
Py_DECREF(tot_kwnames);
525-
if (stack != small_stack) {
526-
PyMem_Free(stack);
527-
}
528525
PyErr_NoMemory();
529-
goto done;
526+
goto clean_stack;
530527
}
531528
stack = tmp_stack;
532529
}
@@ -561,7 +558,7 @@ partial_vectorcall(PyObject *self, PyObject *const *args,
561558
Py_DECREF(tot_kwnames);
562559
}
563560

564-
error:
561+
clean_stack:
565562
if (stack != small_stack) {
566563
PyMem_Free(stack);
567564
}

0 commit comments

Comments
 (0)