Skip to content
This repository was archived by the owner on Jan 20, 2025. It is now read-only.

Commit fa15735

Browse files
Support: clearing up some names, adding missing dereference
1 parent 4a950be commit fa15735

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

pylib/support.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,23 @@ static PyObject* _setup_module(PyObject* module) {
7070
PyObject* collections = PyImport_ImportModule("collections");
7171

7272
// Set up a Command namedtuple object, with empty default for heredocs substructure.
73-
PyObject* defaults = Py_BuildValue("(())");
7473
PyObject *args = Py_BuildValue("ss", "Command", "cmd sub_cmd json original start_line end_line flags value heredocs");
75-
PyObject *keywords = PyDict_New();
76-
PyDict_SetItemString(keywords, "defaults", defaults);
74+
PyObject *kwargs = PyDict_New();
75+
PyObject* defaults = Py_BuildValue("(())");
76+
PyDict_SetItemString(kwargs, "defaults", defaults);
7777
PyObject *namedtuple_method = PyObject_GetAttrString(collections, "namedtuple");
78-
PyDockerfile_Command = PyObject_Call(namedtuple_method, args, keywords);
78+
PyDockerfile_Command = PyObject_Call(namedtuple_method, args, kwargs);
7979
Py_DECREF(args);
80-
Py_DECREF(keywords);
80+
Py_DECREF(kwargs);
81+
Py_DECREF(defaults);
8182
Py_DECREF(namedtuple_method);
8283
PyObject_SetAttrString(
8384
PyDockerfile_Command, "__module__",
8485
PyObject_GetAttrString(module, "__name__")
8586
);
8687
PyModule_AddObject(module, "Command", PyDockerfile_Command);
8788

89+
// Set up a Heredoc namedtuple object.
8890
PyDockerfile_Heredoc = PyObject_CallMethod(
8991
collections, "namedtuple", "ss",
9092
"Heredoc", "name file_descriptor content"

0 commit comments

Comments
 (0)