Skip to content

Commit

Permalink
Fix other refleak
Browse files Browse the repository at this point in the history
  • Loading branch information
JelleZijlstra committed Oct 11, 2023
1 parent f941696 commit 4c42748
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions Parser/asdl_c.py
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,7 @@ def visitModule(self, mod):
}
PyObject *dict = NULL, *fields = NULL, *remaining_fields = NULL,
*positional_args = NULL;
*remaining_dict = NULL, *positional_args = NULL;
if (PyObject_GetOptionalAttr(self, state->__dict__, &dict) < 0) {
return NULL;
}
Expand All @@ -1054,7 +1054,6 @@ def visitModule(self, mod):
// serialize them as a dict, during unpickling they are set only *after*
// the object is constructed, which will now trigger a DeprecationWarning
// if the AST type has required fields.
PyObject *fields = NULL;
if (PyObject_GetOptionalAttr((PyObject*)Py_TYPE(self), state->_fields, &fields) < 0) {
goto cleanup;
}
Expand All @@ -1064,12 +1063,12 @@ def visitModule(self, mod):
Py_DECREF(dict);
goto cleanup;
}
PyObject *remaining_dict = PyDict_Copy(dict);
remaining_dict = PyDict_Copy(dict);
Py_DECREF(dict);
if (!remaining_dict) {
goto cleanup;
}
PyObject *positional_args = PyList_New(0);
positional_args = PyList_New(0);
if (!positional_args) {
goto cleanup;
}
Expand Down Expand Up @@ -1097,7 +1096,7 @@ def visitModule(self, mod):
if (!args_tuple) {
goto cleanup;
}
result = Py_BuildValue("ONN", Py_TYPE(self), args_tuple,
result = Py_BuildValue("ONO", Py_TYPE(self), args_tuple,
remaining_dict);
}
else {
Expand All @@ -1110,6 +1109,7 @@ def visitModule(self, mod):
cleanup:
Py_XDECREF(fields);
Py_XDECREF(remaining_fields);
Py_XDECREF(remaining_dict);
Py_XDECREF(positional_args);
return result;
}
Expand Down
10 changes: 5 additions & 5 deletions Python/Python-ast.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4c42748

Please sign in to comment.